|
From: Owen R. <exo...@us...> - 2004-10-22 11:47:09
|
Update of /cvsroot/nmock/nmock/test/NMock/Dynamic In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19470/test/NMock/Dynamic Modified Files: ClassGeneratorTest.cs InterfaceListerTest.cs Log Message: upgraded to nunit 2.2 upgraded to new version of NAnt Index: ClassGeneratorTest.cs =================================================================== RCS file: /cvsroot/nmock/nmock/test/NMock/Dynamic/ClassGeneratorTest.cs,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** ClassGeneratorTest.cs 23 Jun 2004 04:44:53 -0000 1.17 --- ClassGeneratorTest.cs 22 Oct 2004 11:46:27 -0000 1.18 *************** *** 1,16 **** using System; using System.Collections; using System.Reflection; using System.Reflection.Emit; - - - using NUnit.Framework; - using NMock; using NMock.Constraints; namespace NMock.Dynamic { #region types ! public interface IThingy { void NoArgs(); --- 1,16 ---- using System; using System.Collections; + using System.IO; using System.Reflection; using System.Reflection.Emit; using NMock.Constraints; + using NUnit.Framework; namespace NMock.Dynamic { + #region types ! ! public interface IThingy { void NoArgs(); *************** *** 37,55 **** string AProperty { get; set; } } ! ! public struct MyStruct ! { ! public int x; ! } ! ! class X ! { ! private IMock mock = null; ! ! string stringReturn() { return (string)mock.Invoke("stringReturn", new object[0]); } ! decimal decimalReturn() { return (decimal)mock.Invoke("decimalReturn", new object[0]); } ! MyStruct structReturn() { return (MyStruct)mock.Invoke("structReturn", new object[0]); } ! } ! public interface ISolidThingy { --- 37,66 ---- string AProperty { get; set; } } ! ! public struct MyStruct ! { ! public int x; ! } ! ! internal class X ! { ! private IMock mock = null; ! ! private string stringReturn() ! { ! return (string) mock.Invoke("stringReturn", new object[0]); ! } ! ! private decimal decimalReturn() ! { ! return (decimal) mock.Invoke("decimalReturn", new object[0]); ! } ! ! private MyStruct structReturn() ! { ! return (MyStruct) mock.Invoke("structReturn", new object[0]); ! } ! } ! public interface ISolidThingy { *************** *** 60,75 **** { // internal and protected internal methods must be overridable! ! public virtual string VirtualMethod() { return "xx"; } public abstract string AbstractMethod(); ! protected internal virtual string ProtectedInternalMethod() { return "xx"; } // cannot override ! public static string StaticMethod() { return "xx"; } ! public string NonVirtualMethod() { return "xx"; } ! internal string NonVirtualInternalMethod() { return "xx"; } ! private string privateMethod() { return "xx"; } ! protected virtual string protectedMethod() { return "xx"; } ! string defaultInternalMethod() { return "xx"; } ! public override string ToString() { return "xx"; } // method is ignored // implemented interface members/methods are defined as final (ie. non-virtual) --- 71,121 ---- { // internal and protected internal methods must be overridable! ! public virtual string VirtualMethod() ! { ! return "xx"; ! } ! public abstract string AbstractMethod(); ! ! protected internal virtual string ProtectedInternalMethod() ! { ! return "xx"; ! } // cannot override ! public static string StaticMethod() ! { ! return "xx"; ! } ! ! public string NonVirtualMethod() ! { ! return "xx"; ! } ! ! internal string NonVirtualInternalMethod() ! { ! return "xx"; ! } ! ! private string privateMethod() ! { ! return "xx"; ! } ! ! protected virtual string protectedMethod() ! { ! return "xx"; ! } ! ! private string defaultInternalMethod() ! { ! return "xx"; ! } ! ! public override string ToString() ! { ! return "xx"; ! } // method is ignored // implemented interface members/methods are defined as final (ie. non-virtual) *************** *** 80,109 **** } ! public class ClassWithInternalMethod { ! internal virtual string InternalMethod() { return "xx"; } } ! public enum MyEnum { ! A, B, C, D } ! public class ConcreteThing { ! public virtual void NoArgs() { Assertion.Fail("Should have been overriden"); } } #endregion ! [TestFixture] public class ClassGeneratorInvocationHandlerTest { ! public class InvocationHandlerImpl : IInvocationHandler { public string expectedMethodName; public bool wasCalled = false; ! public object Invoke(string methodName, params object[] args) { ! Assertion.AssertEquals("should be method name", expectedMethodName, methodName); ! Assertion.AssertEquals("Should be no args", 0, args.Length); wasCalled = true; return null; --- 126,167 ---- } ! public class ClassWithInternalMethod { ! internal virtual string InternalMethod() ! { ! return "xx"; ! } } ! public enum MyEnum { ! A, ! B, ! C, ! D } ! ! public class ConcreteThing { ! public virtual void NoArgs() ! { ! Assert.Fail("Should have been overriden"); ! } } + #endregion ! [TestFixture] ! public class ClassGeneratorInvocationHandlerTest { ! public class InvocationHandlerImpl : IInvocationHandler { public string expectedMethodName; public bool wasCalled = false; ! public object Invoke(string methodName, params object[] args) { ! Assert.AreEqual(expectedMethodName, methodName, "should be method name"); ! Assert.AreEqual(0, args.Length, "Should be no args"); wasCalled = true; return null; *************** *** 111,142 **** } ! [Test] public void CreateGenericProxy() { InvocationHandlerImpl handler = new InvocationHandlerImpl(); ! ClassGenerator cg = new ClassGenerator(typeof(IThingy), handler); ! IThingy thingy = (IThingy)cg.Generate(); ! handler.expectedMethodName = "NoArgs"; thingy.NoArgs(); ! Assertion.Assert("Should have been called ", handler.wasCalled); } } ! [TestFixture] public class ClassGeneratorTest { private ClassGenerator cg; private IMock mock; private IThingy thingy; ! ! [SetUp] public void SetUp() { mock = new Mock("Test Mock"); ! cg = new ClassGenerator(typeof(IThingy), mock); ! thingy = (IThingy)cg.Generate(); } ! [Test] public void CallMethodIsCalled() { mock.Expect("NoArgs"); --- 169,204 ---- } ! [Test] ! public void CreateGenericProxy() { InvocationHandlerImpl handler = new InvocationHandlerImpl(); ! ClassGenerator cg = new ClassGenerator(typeof (IThingy), handler); ! IThingy thingy = (IThingy) cg.Generate(); ! handler.expectedMethodName = "NoArgs"; thingy.NoArgs(); ! Assert.IsTrue(handler.wasCalled, "Should have been called "); } } ! [TestFixture] ! public class ClassGeneratorTest { private ClassGenerator cg; private IMock mock; private IThingy thingy; ! ! [SetUp] ! public void SetUp() { mock = new Mock("Test Mock"); ! cg = new ClassGenerator(typeof (IThingy), mock); ! thingy = (IThingy) cg.Generate(); } ! [Test] ! public void CallMethodIsCalled() { mock.Expect("NoArgs"); *************** *** 145,228 **** } ! [Test] public void CallMethodWithReturn() { object x = "sdfs"; mock.ExpectAndReturn("simpleReturn", x); object result = thingy.simpleReturn(); ! Assertion.AssertEquals(x, result); mock.Verify(); } ! [Test] public void CallMethodWithReturnAndCast() { string x = "sdfs"; mock.ExpectAndReturn("stringReturn", x); string result = thingy.stringReturn(); ! Assertion.AssertEquals(x, result); mock.Verify(); } ! [Test] public void CallMethodWithWeirdObjectReturn() { IThingy t = thingy; mock.ExpectAndReturn("AThingy", t); IThingy result = thingy.AThingy(); ! Assertion.AssertEquals(thingy, result); mock.Verify(); } ! [Test] public void CallMethodWithReturnInt() { mock.ExpectAndReturn("intReturn", 7); int result = thingy.intReturn(); ! Assertion.AssertEquals(7, result); mock.Verify(); } ! [Test] public void CallMethodWithReturnBoxings() { mock.ExpectAndReturn("boolReturn", true); mock.ExpectAndReturn("doubleReturn", 1234567891234E+10); ! Assertion.Assert(thingy.boolReturn()); ! Assertion.AssertEquals(1234567891234E+10, thingy.doubleReturn()); mock.Verify(); } ! [Test] ! public void CallMethodWithReturnDecimal() ! { ! decimal d = new decimal(3); ! mock.ExpectAndReturn("decimalReturn", d); ! decimal result = thingy.decimalReturn(); ! Assertion.AssertEquals(new decimal(3), result); ! mock.Verify(); ! } ! ! [Test] ! public void CallMethodWithStruct() ! { ! MyStruct str = new MyStruct(); ! str.x = 3; ! mock.ExpectAndReturn("structReturn", str); ! MyStruct result = thingy.structReturn(); ! Assertion.AssertEquals(str, result); ! mock.Verify(); ! } ! ! [Test] public void CallMethodWithReturnEnum() { mock.ExpectAndReturn("getEnum", MyEnum.C); MyEnum result = thingy.getEnum(); ! Assertion.AssertEquals(MyEnum.C, result); mock.Verify(); } ! ! [Test] [ExpectedException(typeof(System.IO.IOException))] public void CallMethodTheThrowsException() { ! mock.ExpectAndThrow("boolReturn", new System.IO.IOException()); thingy.boolReturn(); } ! [Test] public void CallMethodWithStringParameterExpectation() { mock.Expect("WithSimpleArg", new StartsWith("he")); --- 207,298 ---- } ! [Test] ! public void CallMethodWithReturn() { object x = "sdfs"; mock.ExpectAndReturn("simpleReturn", x); object result = thingy.simpleReturn(); ! Assert.AreEqual(x, result); mock.Verify(); } ! [Test] ! public void CallMethodWithReturnAndCast() { string x = "sdfs"; mock.ExpectAndReturn("stringReturn", x); string result = thingy.stringReturn(); ! Assert.AreEqual(x, result); mock.Verify(); } ! [Test] ! public void CallMethodWithWeirdObjectReturn() { IThingy t = thingy; mock.ExpectAndReturn("AThingy", t); IThingy result = thingy.AThingy(); ! Assert.AreEqual(thingy, result); mock.Verify(); } ! [Test] ! public void CallMethodWithReturnInt() { mock.ExpectAndReturn("intReturn", 7); int result = thingy.intReturn(); ! Assert.AreEqual(7, result); mock.Verify(); } ! [Test] ! public void CallMethodWithReturnBoxings() { mock.ExpectAndReturn("boolReturn", true); mock.ExpectAndReturn("doubleReturn", 1234567891234E+10); ! Assert.IsTrue(thingy.boolReturn()); ! Assert.AreEqual(1234567891234E+10, thingy.doubleReturn()); mock.Verify(); } ! [Test] ! public void CallMethodWithReturnDecimal() ! { ! decimal d = new decimal(3); ! mock.ExpectAndReturn("decimalReturn", d); ! decimal result = thingy.decimalReturn(); ! Assert.AreEqual(new decimal(3), result); ! mock.Verify(); ! } ! ! [Test] ! public void CallMethodWithStruct() ! { ! MyStruct str = new MyStruct(); ! str.x = 3; ! mock.ExpectAndReturn("structReturn", str); ! MyStruct result = thingy.structReturn(); ! Assert.AreEqual(str, result); ! mock.Verify(); ! } ! ! [Test] ! public void CallMethodWithReturnEnum() { mock.ExpectAndReturn("getEnum", MyEnum.C); MyEnum result = thingy.getEnum(); ! Assert.AreEqual(MyEnum.C, result); mock.Verify(); } ! ! [Test, ExpectedException(typeof (IOException))] ! public void CallMethodTheThrowsException() { ! mock.ExpectAndThrow("boolReturn", new IOException()); thingy.boolReturn(); } ! [Test] ! public void CallMethodWithStringParameterExpectation() { mock.Expect("WithSimpleArg", new StartsWith("he")); *************** *** 230,235 **** mock.Verify(); } ! ! [Test] public void CallMethodWithStringParameter() { mock.Expect("WithSimpleArg", "hello"); --- 300,306 ---- mock.Verify(); } ! ! [Test] ! public void CallMethodWithStringParameter() { mock.Expect("WithSimpleArg", "hello"); *************** *** 238,248 **** } ! [Test] public void CallMethodWithIntParameter() { mock.Expect("WithIntParam", 1); thingy.WithIntParam(1); mock.Verify(); ! } ! [Test] [ExpectedException(typeof(VerifyException))] public void CallMethodWithParamExpectationsThatFails() { mock.Expect("WithSimpleArg", new IsEqual("hello")); --- 309,322 ---- } ! [Test] ! public void CallMethodWithIntParameter() { mock.Expect("WithIntParam", 1); thingy.WithIntParam(1); mock.Verify(); ! } ! ! [Test, ExpectedException(typeof (VerifyException))] ! public void CallMethodWithParamExpectationsThatFails() { mock.Expect("WithSimpleArg", new IsEqual("hello")); *************** *** 250,255 **** mock.Verify(); } ! ! [Test] public void CallMethodWithTwoParamExpectations() { mock.Expect("WithTwoArgs", new IsEqual("hello"), new IsEqual("world")); --- 324,330 ---- mock.Verify(); } ! ! [Test] ! public void CallMethodWithTwoParamExpectations() { mock.Expect("WithTwoArgs", new IsEqual("hello"), new IsEqual("world")); *************** *** 257,262 **** mock.Verify(); } ! ! [Test] [ExpectedException(typeof(VerifyException))] public void CallMethodWithTwoParamExpectationsThatFails() { mock.Expect("WithTwoArgs", new IsEqual("hello"), new IsEqual("world")); --- 332,338 ---- mock.Verify(); } ! ! [Test, ExpectedException(typeof (VerifyException))] ! public void CallMethodWithTwoParamExpectationsThatFails() { mock.Expect("WithTwoArgs", new IsEqual("hello"), new IsEqual("world")); *************** *** 264,269 **** mock.Verify(); } ! ! [Test] public void CallMethodWithThreeParamExpectations() { mock.Expect("WithThreeArgs", new IsEqual("hello"), new IsEqual("the"), new IsEqual("world")); --- 340,346 ---- mock.Verify(); } ! ! [Test] ! public void CallMethodWithThreeParamExpectations() { mock.Expect("WithThreeArgs", new IsEqual("hello"), new IsEqual("the"), new IsEqual("world")); *************** *** 271,276 **** mock.Verify(); } ! ! [Test] public void CallMethodWithLotsOfArgsExpectations() { mock.Expect("WithLotsOfArgs", new IsEqual("hello"), new IsEqual("world"), new IsEqual("is"), new IsEqual("this"), new IsEqual("the"), new IsEqual("end")); --- 348,354 ---- mock.Verify(); } ! ! [Test] ! public void CallMethodWithLotsOfArgsExpectations() { mock.Expect("WithLotsOfArgs", new IsEqual("hello"), new IsEqual("world"), new IsEqual("is"), new IsEqual("this"), new IsEqual("the"), new IsEqual("end")); *************** *** 279,283 **** } ! [Test] public void CallMethodWithOtherArgs() { IList l = new ArrayList(); --- 357,362 ---- } ! [Test] ! public void CallMethodWithOtherArgs() { IList l = new ArrayList(); *************** *** 286,296 **** mock.Verify(); } ! [Test] public void CallMethodWithVariableNumberOfParams() { ! mock.Expect("WithParams", 1, new object[]{"string1", "string2"}); thingy.WithParams(1, "string1", "string2"); mock.Verify(); } ! [Test] public void CallMethodWithLongParam() { mock.Expect("WithLongParam", 5L); --- 365,379 ---- mock.Verify(); } ! ! [Test] ! public void CallMethodWithVariableNumberOfParams() { ! mock.Expect("WithParams", 1, new object[] {"string1", "string2"}); thingy.WithParams(1, "string1", "string2"); mock.Verify(); } ! ! [Test] ! public void CallMethodWithLongParam() { mock.Expect("WithLongParam", 5L); *************** *** 299,312 **** } ! [Test] public void CallReadOnlyProperty() { mock.ExpectAndReturn("ReadProperty", "hello"); mock.ExpectAndReturn("ReadProperty", "world"); ! Assertion.AssertEquals("hello", thingy.ReadProperty); ! Assertion.AssertEquals("world", thingy.ReadProperty); mock.Verify(); } ! [Test] public void WriteOnlyPropertyExpectations() { mock.Expect("WriteProperty", "hello"); --- 382,397 ---- } ! [Test] ! public void CallReadOnlyProperty() { mock.ExpectAndReturn("ReadProperty", "hello"); mock.ExpectAndReturn("ReadProperty", "world"); ! Assert.AreEqual("hello", thingy.ReadProperty); ! Assert.AreEqual("world", thingy.ReadProperty); mock.Verify(); } ! [Test] ! public void WriteOnlyPropertyExpectations() { mock.Expect("WriteProperty", "hello"); *************** *** 317,321 **** } ! [Test] public void ReadAndWriteProperty() { mock.Expect("AProperty", "hello"); --- 402,407 ---- } ! [Test] ! public void ReadAndWriteProperty() { mock.Expect("AProperty", "hello"); *************** *** 325,337 **** thingy.AProperty = "hello"; thingy.AProperty = "world"; ! Assertion.AssertEquals("good", thingy.AProperty); ! Assertion.AssertEquals("bye", thingy.AProperty); mock.Verify(); } ! [Test] public void CanExtendAbstractClass() { ! cg = new ClassGenerator(typeof(AbstractThingy), mock); ! AbstractThingy s = (AbstractThingy)cg.Generate(); mock.ExpectAndReturn("VirtualMethod", "hello"); --- 411,424 ---- thingy.AProperty = "hello"; thingy.AProperty = "world"; ! Assert.AreEqual("good", thingy.AProperty); ! Assert.AreEqual("bye", thingy.AProperty); mock.Verify(); } ! [Test] ! public void CanExtendAbstractClass() { ! cg = new ClassGenerator(typeof (AbstractThingy), mock); ! AbstractThingy s = (AbstractThingy) cg.Generate(); mock.ExpectAndReturn("VirtualMethod", "hello"); *************** *** 340,371 **** mock.ExpectAndReturn("ProtectedInternalMethod", "white"); ! Assertion.AssertEquals("hello", s.VirtualMethod()); ! Assertion.AssertEquals(123, s.GetHashCode()); ! Assertion.AssertEquals("fish", s.AbstractMethod()); ! Assertion.AssertEquals("white", s.ProtectedInternalMethod()); mock.Verify(); } ! ! [Test] public void CheckBoxingOpCodes() { BoxingOpCodes opCodes = new BoxingOpCodes(); ! Assertion.AssertEquals( OpCodes.Ldind_I1, opCodes[typeof(sbyte)] ); ! Assertion.AssertEquals( OpCodes.Ldind_I2, opCodes[typeof(short)] ); ! Assertion.AssertEquals( OpCodes.Ldind_I4, opCodes[typeof(int)] ); ! Assertion.AssertEquals( OpCodes.Ldind_I8, opCodes[typeof(long)] ); ! Assertion.AssertEquals( OpCodes.Ldind_U1, opCodes[typeof(byte)] ); ! Assertion.AssertEquals( OpCodes.Ldind_U2, opCodes[typeof(ushort)] ); ! Assertion.AssertEquals( OpCodes.Ldind_U4, opCodes[typeof(uint)] ); ! Assertion.AssertEquals( OpCodes.Ldind_I8, opCodes[typeof(ulong)] ); ! Assertion.AssertEquals( OpCodes.Ldind_R4, opCodes[typeof(float)] ); ! Assertion.AssertEquals( OpCodes.Ldind_R8, opCodes[typeof(double)] ); ! Assertion.AssertEquals( OpCodes.Ldind_U2, opCodes[typeof(char)] ); ! Assertion.AssertEquals( OpCodes.Ldind_I1, opCodes[typeof(bool)] ); } ! [Test] public void CanExtendConcreteClass() { ! ConcreteThing concrete = (ConcreteThing)(new ClassGenerator(typeof(ConcreteThing), mock)).Generate(); mock.Expect("NoArgs"); --- 427,461 ---- mock.ExpectAndReturn("ProtectedInternalMethod", "white"); ! Assert.AreEqual("hello", s.VirtualMethod()); ! Assert.AreEqual(123, s.GetHashCode()); ! Assert.AreEqual("fish", s.AbstractMethod()); ! Assert.AreEqual("white", s.ProtectedInternalMethod()); mock.Verify(); } ! ! [Test] ! public void CheckBoxingOpCodes() { BoxingOpCodes opCodes = new BoxingOpCodes(); ! Assert.AreEqual(OpCodes.Ldind_I1, opCodes[typeof (sbyte)]); ! Assert.AreEqual(OpCodes.Ldind_I2, opCodes[typeof (short)]); ! Assert.AreEqual(OpCodes.Ldind_I4, opCodes[typeof (int)]); ! Assert.AreEqual(OpCodes.Ldind_I8, opCodes[typeof (long)]); ! Assert.AreEqual(OpCodes.Ldind_U1, opCodes[typeof (byte)]); ! Assert.AreEqual(OpCodes.Ldind_U2, opCodes[typeof (ushort)]); ! Assert.AreEqual(OpCodes.Ldind_U4, opCodes[typeof (uint)]); ! Assert.AreEqual(OpCodes.Ldind_I8, opCodes[typeof (ulong)]); ! Assert.AreEqual(OpCodes.Ldind_R4, opCodes[typeof (float)]); ! Assert.AreEqual(OpCodes.Ldind_R8, opCodes[typeof (double)]); ! Assert.AreEqual(OpCodes.Ldind_U2, opCodes[typeof (char)]); ! Assert.AreEqual(OpCodes.Ldind_I1, opCodes[typeof (bool)]); } ! ! [Test] ! public void CanExtendConcreteClass() { ! ConcreteThing concrete = (ConcreteThing) (new ClassGenerator(typeof (ConcreteThing), mock)).Generate(); mock.Expect("NoArgs"); *************** *** 375,417 **** // Limitations ! [Test] public void CannotOverrideNonVirtualFeatures() { ! cg = new ClassGenerator(typeof(AbstractThingy), mock); ! AbstractThingy s = (AbstractThingy)cg.Generate(); mock.SetupResult("NonVirtualMethod", "non virtual method"); mock.SetupResult("NonVirtualProperty", "non virtual property"); ! Assertion.AssertEquals("xx", s.NonVirtualMethod()); ! Assertion.AssertEquals("xx", s.NonVirtualProperty); mock.Verify(); } ! [Test] public void DoesNotOverrideToString() { ! cg = new ClassGenerator(typeof(AbstractThingy), mock); ! AbstractThingy s = (AbstractThingy)cg.Generate(); mock.SetupResult("ToString", "to string"); ! Assertion.AssertEquals("xx", s.ToString()); mock.Verify(); } ! [Test] public void IgnoresInternalMethodsBecauseOfAssemblyVisibility() { ArrayList methodsToIgnore = new ArrayList(); ! new ClassGenerator(typeof(ClassWithInternalMethod), mock, methodsToIgnore).Generate(); ! Assertion.Assert("Should include InternalMethod", methodsToIgnore.Contains("InternalMethod")); } ! ! [Test] public void OnlyOneAssemblyIsCreated() { ! cg = new ClassGenerator(typeof(IThingy), mock); cg.Generate(); int originalAssemblyCount = AppDomain.CurrentDomain.GetAssemblies().Length; ! cg = new ClassGenerator(typeof(ConcreteThing), mock); cg.Generate(); --- 465,511 ---- // Limitations ! [Test] ! public void CannotOverrideNonVirtualFeatures() { ! cg = new ClassGenerator(typeof (AbstractThingy), mock); ! AbstractThingy s = (AbstractThingy) cg.Generate(); mock.SetupResult("NonVirtualMethod", "non virtual method"); mock.SetupResult("NonVirtualProperty", "non virtual property"); ! Assert.AreEqual("xx", s.NonVirtualMethod()); ! Assert.AreEqual("xx", s.NonVirtualProperty); mock.Verify(); } ! [Test] ! public void DoesNotOverrideToString() { ! cg = new ClassGenerator(typeof (AbstractThingy), mock); ! AbstractThingy s = (AbstractThingy) cg.Generate(); mock.SetupResult("ToString", "to string"); ! Assert.AreEqual("xx", s.ToString()); mock.Verify(); } ! [Test] ! public void IgnoresInternalMethodsBecauseOfAssemblyVisibility() { ArrayList methodsToIgnore = new ArrayList(); ! new ClassGenerator(typeof (ClassWithInternalMethod), mock, methodsToIgnore).Generate(); ! Assert.IsTrue(methodsToIgnore.Contains("InternalMethod"), "Should include InternalMethod"); } ! ! [Test] ! public void OnlyOneAssemblyIsCreated() { ! cg = new ClassGenerator(typeof (IThingy), mock); cg.Generate(); int originalAssemblyCount = AppDomain.CurrentDomain.GetAssemblies().Length; ! cg = new ClassGenerator(typeof (ConcreteThing), mock); cg.Generate(); *************** *** 419,432 **** } ! [Test] public void MockTypesAreReused() { ! cg = new ClassGenerator(typeof(Exception), mock); cg.Generate(); Assembly mockAssembly = null; ! foreach(Assembly ass in AppDomain.CurrentDomain.GetAssemblies()) { ! if(ass.GetName().Name == "DynamicProxyAssembly") { mockAssembly = ass; --- 513,527 ---- } ! [Test] ! public void MockTypesAreReused() { ! cg = new ClassGenerator(typeof (Exception), mock); cg.Generate(); Assembly mockAssembly = null; ! foreach (Assembly ass in AppDomain.CurrentDomain.GetAssemblies()) { ! if (ass.GetName().Name == "DynamicProxyAssembly") { mockAssembly = ass; *************** *** 438,442 **** int originalTypeCount = mockAssembly.GetTypes().Length; ! cg = new ClassGenerator(typeof(Exception), mock); cg.Generate(); --- 533,537 ---- int originalTypeCount = mockAssembly.GetTypes().Length; ! cg = new ClassGenerator(typeof (Exception), mock); cg.Generate(); *************** *** 444,446 **** } } ! } --- 539,541 ---- } } ! } \ No newline at end of file Index: InterfaceListerTest.cs =================================================================== RCS file: /cvsroot/nmock/nmock/test/NMock/Dynamic/InterfaceListerTest.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** InterfaceListerTest.cs 1 Jun 2003 09:48:50 -0000 1.1 --- InterfaceListerTest.cs 22 Oct 2004 11:46:27 -0000 1.2 *************** *** 174,178 **** actualString.Append(","); } ! Assertion.AssertEquals(expectedString.ToString(), actualString.ToString()); } --- 174,178 ---- actualString.Append(","); } ! Assert.AreEqual(expectedString.ToString(), actualString.ToString()); } |