From: <gc...@us...> - 2002-12-29 02:47:42
|
Update of /cvsroot/dotnetmock/dotnetmock/DotNetMock.Tests/Dynamic In directory sc8-pr-cvs1:/tmp/cvs-serv13414/DotNetMock.Tests/Dynamic Modified Files: MockTests.cs PredicateTests.cs Log Message: Added MailingList Example Index: MockTests.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock.Tests/Dynamic/MockTests.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MockTests.cs 25 Oct 2002 03:02:27 -0000 1.2 --- MockTests.cs 29 Dec 2002 02:47:39 -0000 1.3 *************** *** 2,5 **** --- 2,6 ---- using NUnit.Framework; using DotNetMock.Dynamic; + using DotNetMock.Dynamic.Predicates; namespace DotNetMock.Tests.Dynamic *************** *** 40,44 **** [Test] ! [ExpectedException(typeof(AssertionException))] public void NoCallToVoidMethod() { --- 41,45 ---- [Test] ! [ExpectedException(typeof(VerifyException))] public void NoCallToVoidMethod() { *************** *** 48,52 **** [Test] ! [ExpectedException(typeof(AssertionException))] public void TooManyCallsToVoidMethod() { --- 49,53 ---- [Test] ! [ExpectedException(typeof(VerifyException))] public void TooManyCallsToVoidMethod() { *************** *** 77,81 **** [Test] ! [ExpectedException(typeof(AssertionException))] public void CallToMethodWithInvalidParams() { --- 78,82 ---- [Test] ! [ExpectedException(typeof(VerifyException))] public void CallToMethodWithInvalidParams() { *************** *** 105,109 **** [Test] - [ExpectedException(typeof(AssertionException))] public void CallMultipleMethodsInWrongOrder() { --- 106,109 ---- *************** *** 138,142 **** [Test] ! [ExpectedException(typeof(AssertionException))] public void CallToNonVoidMethodWithWrongParams() { --- 138,142 ---- [Test] ! [ExpectedException(typeof(VerifyException))] public void CallToNonVoidMethodWithWrongParams() { *************** *** 180,184 **** [Test] ! [ExpectedException(typeof(AssertionException))] public void DefaultEqualsPredicatesFailure() { --- 180,184 ---- [Test] ! [ExpectedException(typeof(VerifyException))] public void DefaultEqualsPredicatesFailure() { Index: PredicateTests.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock.Tests/Dynamic/PredicateTests.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PredicateTests.cs 25 Oct 2002 03:02:27 -0000 1.2 --- PredicateTests.cs 29 Dec 2002 02:47:39 -0000 1.3 *************** *** 3,6 **** --- 3,7 ---- using NUnit.Framework; using DotNetMock.Dynamic; + using DotNetMock.Dynamic.Predicates; namespace DotNetMock.Tests.Dynamic *************** *** 21,29 **** { p = new IsNull(); ! Assertion.Assert(p.eval(null)); ! Assertion.Assert(!p.eval(new object())); ! Assertion.Assert(!p.eval(1)); ! Assertion.Assert(!p.eval(true)); ! Assertion.Assert(!p.eval(false)); } --- 22,30 ---- { p = new IsNull(); ! Assertion.Assert(p.Eval(null)); ! Assertion.Assert(!p.Eval(new object())); ! Assertion.Assert(!p.Eval(1)); ! Assertion.Assert(!p.Eval(true)); ! Assertion.Assert(!p.Eval(false)); } *************** *** 32,37 **** { p = new NotNull(); ! Assertion.Assert(!p.eval(null)); ! Assertion.Assert(p.eval(new object())); } --- 33,38 ---- { p = new NotNull(); ! Assertion.Assert(!p.Eval(null)); ! Assertion.Assert(p.Eval(new object())); } *************** *** 42,56 **** object o2 = new object(); p = new IsEqual(o1); ! Assertion.Assert(p.eval(o1)); ! Assertion.Assert(!p.eval(o2)); ! Assertion.Assert(!p.eval(null)); int i1 = 1; int i2 = 2; p = new IsEqual(i1); ! Assertion.Assert(p.eval(i1)); ! Assertion.Assert(p.eval(1)); ! Assertion.Assert(!p.eval(i2)); ! Assertion.Assert(!p.eval(2)); } --- 43,57 ---- object o2 = new object(); p = new IsEqual(o1); ! Assertion.Assert(p.Eval(o1)); ! Assertion.Assert(!p.Eval(o2)); ! Assertion.Assert(!p.Eval(null)); int i1 = 1; int i2 = 2; p = new IsEqual(i1); ! Assertion.Assert(p.Eval(i1)); ! Assertion.Assert(p.Eval(1)); ! Assertion.Assert(!p.Eval(i2)); ! Assertion.Assert(!p.Eval(2)); } *************** *** 61,75 **** object o2 = new object(); p = new NotEqual(o1); ! Assertion.Assert(!p.eval(o1)); ! Assertion.Assert(p.eval(o2)); ! Assertion.Assert(p.eval(null)); int i1 = 1; int i2 = 2; p = new NotEqual(i1); ! Assertion.Assert(!p.eval(i1)); ! Assertion.Assert(!p.eval(1)); ! Assertion.Assert(p.eval(i2)); ! Assertion.Assert(p.eval(2)); } --- 62,76 ---- object o2 = new object(); p = new NotEqual(o1); ! Assertion.Assert(!p.Eval(o1)); ! Assertion.Assert(p.Eval(o2)); ! Assertion.Assert(p.Eval(null)); int i1 = 1; int i2 = 2; p = new NotEqual(i1); ! Assertion.Assert(!p.Eval(i1)); ! Assertion.Assert(!p.Eval(1)); ! Assertion.Assert(p.Eval(i2)); ! Assertion.Assert(p.Eval(2)); } *************** *** 78,90 **** { p = new IsAnything(); ! Assertion.Assert(p.eval(null)); ! Assertion.Assert(p.eval(0)); ! Assertion.Assert(p.eval(99)); ! Assertion.Assert(p.eval(-2)); ! Assertion.Assert(p.eval(true)); ! Assertion.Assert(p.eval(false)); ! Assertion.Assert(p.eval("")); ! Assertion.Assert(p.eval("hello")); ! Assertion.Assert(p.eval(new object())); } --- 79,91 ---- { p = new IsAnything(); ! Assertion.Assert(p.Eval(null)); ! Assertion.Assert(p.Eval(0)); ! Assertion.Assert(p.Eval(99)); ! Assertion.Assert(p.Eval(-2)); ! Assertion.Assert(p.Eval(true)); ! Assertion.Assert(p.Eval(false)); ! Assertion.Assert(p.Eval("")); ! Assertion.Assert(p.Eval("hello")); ! Assertion.Assert(p.Eval(new object())); } *************** *** 93,99 **** { p = new IsTypeOf(typeof(System.IO.TextReader)); ! Assertion.Assert(!p.eval(null)); ! Assertion.Assert(p.eval(new System.IO.StringReader(""))); ! Assertion.Assert(!p.eval(new System.IO.StringWriter())); } --- 94,100 ---- { p = new IsTypeOf(typeof(System.IO.TextReader)); ! Assertion.Assert(!p.Eval(null)); ! Assertion.Assert(p.Eval(new System.IO.StringReader(""))); ! Assertion.Assert(!p.Eval(new System.IO.StringWriter())); } *************** *** 101,106 **** public void Not() { ! Assertion.Assert(new Not(new False()).eval(null)); ! Assertion.Assert(!new Not(new True()).eval(null)); } --- 102,107 ---- public void Not() { ! Assertion.Assert(new NotPredicate(new False()).Eval(null)); ! Assertion.Assert(!new NotPredicate(new True()).Eval(null)); } *************** *** 108,115 **** public void And() { ! Assertion.Assert( new And(new True() , new True() ).eval(null)); ! Assertion.Assert(!new And(new True() , new False()).eval(null)); ! Assertion.Assert(!new And(new False(), new True() ).eval(null)); ! Assertion.Assert(!new And(new False(), new False()).eval(null)); } --- 109,116 ---- public void And() { ! Assertion.Assert( new AndPredicate(new True() , new True() ).Eval(null)); ! Assertion.Assert(!new AndPredicate(new True() , new False()).Eval(null)); ! Assertion.Assert(!new AndPredicate(new False(), new True() ).Eval(null)); ! Assertion.Assert(!new AndPredicate(new False(), new False()).Eval(null)); } *************** *** 117,124 **** public void Or() { ! Assertion.Assert( new Or(new True() , new True() ).eval(null)); ! Assertion.Assert( new Or(new True() , new False()).eval(null)); ! Assertion.Assert( new Or(new False(), new True() ).eval(null)); ! Assertion.Assert(!new Or(new False(), new False()).eval(null)); } --- 118,125 ---- public void Or() { ! Assertion.Assert( new OrPredicate(new True() , new True() ).Eval(null)); ! Assertion.Assert( new OrPredicate(new True() , new False()).Eval(null)); ! Assertion.Assert( new OrPredicate(new False(), new True() ).Eval(null)); ! Assertion.Assert(!new OrPredicate(new False(), new False()).Eval(null)); } *************** *** 127,143 **** { p = new IsIn(2, 3, 5); ! Assertion.Assert(!p.eval(1)); ! Assertion.Assert(p.eval(2)); ! Assertion.Assert(p.eval(3)); ! Assertion.Assert(!p.eval(4)); ! Assertion.Assert(p.eval(5)); ! Assertion.Assert(!p.eval(6)); ! Assertion.Assert(!p.eval(null)); int[] array = {1, 2}; p = new IsIn(array); ! Assertion.Assert(p.eval(1)); ! Assertion.Assert(p.eval(2)); ! Assertion.Assert(!p.eval(3)); } --- 128,144 ---- { p = new IsIn(2, 3, 5); ! Assertion.Assert(!p.Eval(1)); ! Assertion.Assert(p.Eval(2)); ! Assertion.Assert(p.Eval(3)); ! Assertion.Assert(!p.Eval(4)); ! Assertion.Assert(p.Eval(5)); ! Assertion.Assert(!p.Eval(6)); ! Assertion.Assert(!p.Eval(null)); int[] array = {1, 2}; p = new IsIn(array); ! Assertion.Assert(p.Eval(1)); ! Assertion.Assert(p.Eval(2)); ! Assertion.Assert(!p.Eval(3)); } *************** *** 146,158 **** { p = new NotIn(1, 2); ! Assertion.Assert(!p.eval(1)); ! Assertion.Assert(!p.eval(2)); ! Assertion.Assert(p.eval(3)); int[] array = {1, 2}; p = new NotIn(array); ! Assertion.Assert(!p.eval(1)); ! Assertion.Assert(!p.eval(2)); ! Assertion.Assert(p.eval(3)); } --- 147,159 ---- { p = new NotIn(1, 2); ! Assertion.Assert(!p.Eval(1)); ! Assertion.Assert(!p.Eval(2)); ! Assertion.Assert(p.Eval(3)); int[] array = {1, 2}; p = new NotIn(array); ! Assertion.Assert(!p.Eval(1)); ! Assertion.Assert(!p.Eval(2)); ! Assertion.Assert(p.Eval(3)); } *************** *** 161,168 **** { p = new IsEqualIgnoreCase("heLLo"); ! Assertion.Assert(p.eval("HELLO")); ! Assertion.Assert(p.eval("hello")); ! Assertion.Assert(p.eval("HelLo")); ! Assertion.Assert(!p.eval("abcde")); } --- 162,169 ---- { p = new IsEqualIgnoreCase("heLLo"); ! Assertion.Assert(p.Eval("HELLO")); ! Assertion.Assert(p.Eval("hello")); ! Assertion.Assert(p.Eval("HelLo")); ! Assertion.Assert(!p.Eval("abcde")); } *************** *** 179,186 **** { p = new IsEqualIgnoreWhiteSpace("Hello World how\n are we?"); ! Assertion.Assert(p.eval("Hello World how are we?")); ! Assertion.Assert(p.eval(" Hello World how are \n\n\twe?")); ! Assertion.Assert(!p.eval("HelloWorld how are we?")); ! Assertion.Assert(!p.eval("Hello World how are we")); } --- 180,187 ---- { p = new IsEqualIgnoreWhiteSpace("Hello World how\n are we?"); ! Assertion.Assert(p.Eval("Hello World how are we?")); ! Assertion.Assert(p.Eval(" Hello World how are \n\n\twe?")); ! Assertion.Assert(!p.Eval("HelloWorld how are we?")); ! Assertion.Assert(!p.Eval("Hello World how are we")); } *************** *** 189,214 **** { p = new IsMatch(new Regex(@"^th[aeiou]\w* .*$")); ! Assertion.Assert(p.eval("the world")); ! Assertion.Assert(!p.eval("theworld")); ! Assertion.Assert(!p.eval("ThE world")); ! Assertion.Assert(!p.eval(" the world")); ! Assertion.Assert(p.eval("thats nice")); ! Assertion.Assert(!p.eval(new object())); ! Assertion.Assert(!p.eval(null)); p = new IsMatch(@"^th[aeiou]\w* .*$"); ! Assertion.Assert(p.eval("the world")); ! Assertion.Assert(!p.eval("theworld")); ! Assertion.Assert(!p.eval("ThE world")); p = new IsMatch(@"^th[aeiou]\w* .*$", false); ! Assertion.Assert(p.eval("the world")); ! Assertion.Assert(!p.eval("theworld")); ! Assertion.Assert(!p.eval("ThE world")); p = new IsMatch(@"^th[aeiou]\w* .*$", true); ! Assertion.Assert(p.eval("the world")); ! Assertion.Assert(!p.eval("theworld")); ! Assertion.Assert(p.eval("ThE world")); } --- 190,215 ---- { p = new IsMatch(new Regex(@"^th[aeiou]\w* .*$")); ! Assertion.Assert(p.Eval("the world")); ! Assertion.Assert(!p.Eval("theworld")); ! Assertion.Assert(!p.Eval("ThE world")); ! Assertion.Assert(!p.Eval(" the world")); ! Assertion.Assert(p.Eval("thats nice")); ! Assertion.Assert(!p.Eval(new object())); ! Assertion.Assert(!p.Eval(null)); p = new IsMatch(@"^th[aeiou]\w* .*$"); ! Assertion.Assert(p.Eval("the world")); ! Assertion.Assert(!p.Eval("theworld")); ! Assertion.Assert(!p.Eval("ThE world")); p = new IsMatch(@"^th[aeiou]\w* .*$", false); ! Assertion.Assert(p.Eval("the world")); ! Assertion.Assert(!p.Eval("theworld")); ! Assertion.Assert(!p.Eval("ThE world")); p = new IsMatch(@"^th[aeiou]\w* .*$", true); ! Assertion.Assert(p.Eval("the world")); ! Assertion.Assert(!p.Eval("theworld")); ! Assertion.Assert(p.Eval("ThE world")); } *************** *** 219,226 **** p = new Predicate(new Predicate.Method(myEval)); myFlag = false; ! Assertion.Assert(p.eval(null)); ! Assertion.Assert(!p.eval(null)); ! Assertion.Assert(p.eval(null)); ! Assertion.Assert(!p.eval(null)); } --- 220,227 ---- p = new Predicate(new Predicate.Method(myEval)); myFlag = false; ! Assertion.Assert(p.Eval(null)); ! Assertion.Assert(!p.Eval(null)); ! Assertion.Assert(p.Eval(null)); ! Assertion.Assert(!p.Eval(null)); } *************** *** 235,239 **** class True : IPredicate { ! public bool eval(object val) { return true; --- 236,240 ---- class True : IPredicate { ! public bool Eval(object val) { return true; *************** *** 243,247 **** class False : IPredicate { ! public bool eval(object val) { return false; --- 244,248 ---- class False : IPredicate { ! public bool Eval(object val) { return false; |