.Net 1.1
NUnit 2.2
TypeMock 3.0.3.0
Test Fixture Code:
using System;
using NUnit.Framework;
using Rbsfm.Common.Sentinel.SessionState.WebServices.SessionStores;
using TypeMock;
namespace Rbsfm.Common.Sentinel.SessionState.WebServices
{
[TestFixture]
public class SessionPersistTest
{
protected SessionPersist sessionPersist;
protected Mock mockStaticSessionStore;
protected string expectedSessionId;
protected string expectedSessionVariableName;
protected string expectedSessionVariableValue;
[SetUp]
public void SetUp()
{
this.expectedSessionId = Guid.NewGuid().ToString();
this.expectedSessionVariableName = "TestParam";
this.expectedSessionVariableValue = "TestParamValue";
MockManager.Init();
this.mockStaticSessionStore = MockManager.MockAll(typeof(StaticSessionStore), Constructor.NotMocked);
this.sessionPersist = new SessionPersist();
}
[TearDown]
public void TearDown()
{
MockManager.Verify();
}
[Test]
public void SetSessionDataTest()
{
this.mockStaticSessionStore.ExpectCall("SetSessionData").Args(this.expectedSessionId, this.expectedSessionVariableName, this.expectedSessionVariableValue);
this.sessionPersist.SetSessionData(this.expectedSessionId, this.expectedSessionVariableName, this.expectedSessionVariableValue);
}
[Test]
public void GetSessionDataTest()
{
this.mockStaticSessionStore.ExpectCall("GetSessionData").Args(this.expectedSessionId, this.expectedSessionVariableName);
this.sessionPersist.GetSessionData(this.expectedSessionId, this.expectedSessionVariableName);
}
[Test]
public void ReleaseSession()
{
this.mockStaticSessionStore.ExpectCall("ReleaseSession").Args(this.expectedSessionId);
this.sessionPersist.ReleaseSession(this.expectedSessionId);
}
}
}
These tests pass just fine when run in NUnit Gui application but fail as follows when run using:
tmockrunner nunit-console myTestAssembly.dll
NUnit version 2.2.0
Copyright (C) 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, C
harlie Poole.
Copyright (C) 2000-2003 Philip Craig.
All Rights Reserved.
OS Version: Microsoft Windows NT 5.1.2600.0 .NET Version: 1.1.4322.2052
......F.F.F
Tests run: 8, Failures: 3, Not run: 0, Time: 0.2812824 seconds
Failures:
1) Rbsfm.Common.Sentinel.SessionState.WebServices.SessionPersistTest.SetSessionD
ataTest :
TearDown : TypeMock.VerifyException :
TypeMock Verification: Method Rbsfm.Common.Sentinel.SessionState.WebServices.Ses
sionStores.StaticSessionStore.SetSessionData() has 1 more expected calls
--TearDown
at TypeMock.MockManager.Verify()
at Rbsfm.Common.Sentinel.SessionState.WebServices.SessionPersistTest.TearDown
() in c:devwebdotnet.1
bsfm.common.sentinel.sessionstate.webservices.test
sessionpersisttest.cs:line 38
2) Rbsfm.Common.Sentinel.SessionState.WebServices.SessionPersistTest.GetSessionD
ataTest :
TearDown : TypeMock.VerifyException :
TypeMock Verification: Method Rbsfm.Common.Sentinel.SessionState.WebServices.Ses
sionStores.StaticSessionStore.GetSessionData() has 1 more expected calls
--TearDown
at TypeMock.MockManager.Verify()
at Rbsfm.Common.Sentinel.SessionState.WebServices.SessionPersistTest.TearDown
() in c:devwebdotnet.1
bsfm.common.sentinel.sessionstate.webservices.test
sessionpersisttest.cs:line 38
3) Rbsfm.Common.Sentinel.SessionState.WebServices.SessionPersistTest.ReleaseSess
ion :
TearDown : TypeMock.VerifyException :
TypeMock Verification: Method Rbsfm.Common.Sentinel.SessionState.WebServices.Ses
sionStores.StaticSessionStore.ReleaseSession() has 1 more expected calls
--TearDown
at TypeMock.MockManager.Verify()
at Rbsfm.Common.Sentinel.SessionState.WebServices.SessionPersistTest.TearDown
() in c:devwebdotnet.1
bsfm.common.sentinel.sessionstate.webservices.test
sessionpersisttest.cs:line 38
I have TypeMock.out but it is very large and the mocked methods are not at the end of the file.
Please advise how I can forward the .out file.