From: Griffin C. <gc...@us...> - 2005-01-01 21:14:10
|
Update of /cvsroot/dotnetmock/dotnetmock/DotNetMock/Dynamic/Predicates In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30794/DotNetMock/Dynamic/Predicates Modified Files: AndPredicate.cs IsAnything.cs IsCloseTo.cs IsEqual.cs IsEqualIgnoreCase.cs IsEqualIgnoreWhiteSpace.cs IsIn.cs IsMatch.cs IsNull.cs IsTypeOf.cs NotEqual.cs NotIn.cs NotNull.cs NotPredicate.cs OrPredicate.cs Predicate.cs Log Message: - Added remaining XML docs to DotNetMock project - Removed 'using' directives - Minor coding stds refactorings - Removed Apache license from Predicate classes. Index: AndPredicate.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/Dynamic/Predicates/AndPredicate.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AndPredicate.cs 24 Jul 2004 13:45:14 -0000 1.3 --- AndPredicate.cs 1 Jan 2005 21:13:54 -0000 1.4 *************** *** 1,10 **** - using System; - namespace DotNetMock.Dynamic.Predicates { public class AndPredicate : IPredicate { private IPredicate p1, p2; ! public AndPredicate(IPredicate p1, IPredicate p2) { --- 1,15 ---- namespace DotNetMock.Dynamic.Predicates { + /// <summary> + /// Represets a <see cref="IPredicate"/> that expects a value to satisfy two predicates. + /// </summary> public class AndPredicate : IPredicate { private IPredicate p1, p2; ! /// <summary> ! /// Default Constructor ! /// </summary> ! /// <param name="p1">first <see cref="IPredicate"/></param> ! /// <param name="p2">first <see cref="IPredicate"/></param> public AndPredicate(IPredicate p1, IPredicate p2) { *************** *** 12,16 **** this.p2 = p2; } ! public bool Eval(object currentValue) { --- 17,25 ---- this.p2 = p2; } ! /// <summary> ! /// Evaluates the input value against both <see cref="IPredicate"/>s ! /// </summary> ! /// <param name="currentValue">Value to evaluate</param> ! /// <returns>True if the input value satisfies both <see cref="IPredicate"/> instances</returns> public bool Eval(object currentValue) { Index: IsTypeOf.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/Dynamic/Predicates/IsTypeOf.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IsTypeOf.cs 1 Apr 2003 01:43:57 -0000 1.2 --- IsTypeOf.cs 1 Jan 2005 21:13:54 -0000 1.3 *************** *** 1,67 **** - /* - * ============================================================================ - * The Apache Software License, Version 1.1 - * ============================================================================ - * - * Copyright (C) 1999 The Apache Software Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modifica- - * tion, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. The end-user documentation included with the redistribution, if any, must - * include the following acknowledgment: "This product includes software - * developed by the Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, if - * and wherever such third-party acknowledgments normally appear. - * - * 4. The names "log4j" and "Apache Software Foundation" must not be used to - * endorse or promote products derived from this software without prior - * written permission. For written permission, please contact - * ap...@ap.... - * - * 5. Products derived from this software may not be called "Apache", nor may - * "Apache" appear in their name, without prior written permission of the - * Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- - * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * on behalf of the Apache Software Foundation. For more information on the - * Apache Software Foundation, please see <http://www.apache.org/>. - * - */ - using System; namespace DotNetMock.Dynamic.Predicates { public class IsTypeOf : IPredicate { ! private Type type; ! public IsTypeOf(Type type) { ! this.type = type; } ! public bool Eval(object currentValue) { ! return currentValue == null ? false : type.IsAssignableFrom(currentValue.GetType()); } } --- 1,28 ---- using System; namespace DotNetMock.Dynamic.Predicates { + /// <summary> + /// <see cref="IPredicate"/> that evaluates the input value against the expected <see cref="Type"/> + /// </summary> public class IsTypeOf : IPredicate { ! private Type _type; ! /// <summary> ! /// Default Constructor ! /// </summary> ! /// <param name="type">type to evaluate against</param> public IsTypeOf(Type type) { ! this._type = type; } ! /// <summary> ! /// Evaluates the input value to verify that it is correctly typed. ! /// </summary> ! /// <param name="currentValue">input value</param> ! /// <returns>True if the original type is assignable from the input value, false otherwise.</returns> public bool Eval(object currentValue) { ! return currentValue == null ? false : _type.IsAssignableFrom(currentValue.GetType()); } } Index: IsIn.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/Dynamic/Predicates/IsIn.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IsIn.cs 1 Apr 2003 01:43:57 -0000 1.2 --- IsIn.cs 1 Jan 2005 21:13:54 -0000 1.3 *************** *** 1,59 **** - /* - * ============================================================================ - * The Apache Software License, Version 1.1 - * ============================================================================ - * - * Copyright (C) 1999 The Apache Software Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modifica- - * tion, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. The end-user documentation included with the redistribution, if any, must - * include the following acknowledgment: "This product includes software - * developed by the Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, if - * and wherever such third-party acknowledgments normally appear. - * - * 4. The names "log4j" and "Apache Software Foundation" must not be used to - * endorse or promote products derived from this software without prior - * written permission. For written permission, please contact - * ap...@ap.... - * - * 5. Products derived from this software may not be called "Apache", nor may - * "Apache" appear in their name, without prior written permission of the - * Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- - * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * on behalf of the Apache Software Foundation. For more information on the - * Apache Software Foundation, please see <http://www.apache.org/>. - * - */ - using System; namespace DotNetMock.Dynamic.Predicates { public class IsIn : IPredicate { ! private object[] inList; ! public IsIn(params object[] inList) { --- 1,16 ---- using System; namespace DotNetMock.Dynamic.Predicates { + /// <summary> + /// <see cref="IPredicate"/> that looks for an input value in an array of values. + /// </summary> public class IsIn : IPredicate { ! private object[] _inList; ! /// <summary> ! /// Default Constructor ! /// </summary> ! /// <param name="inList">array of values to use for searching</param> public IsIn(params object[] inList) { *************** *** 61,78 **** { Array arr = (Array)inList[0]; ! this.inList = new object[arr.Length]; ! arr.CopyTo(this.inList, 0); } else { ! this.inList = inList; } } ! ! public bool Eval(object currentValue) { ! foreach (object o in inList) { ! if (o.Equals(currentValue)) { return true; --- 18,39 ---- { Array arr = (Array)inList[0]; ! this._inList = new object[arr.Length]; ! arr.CopyTo(this._inList, 0); } else { ! this._inList = inList; } } ! /// <summary> ! /// Evaluates the input value by looking within the original array list of values for the input value. ! /// </summary> ! /// <param name="inputValue">input value to look for</param> ! /// <returns>True if the input value is found, false otherwise.</returns> ! public bool Eval(object inputValue) { ! foreach (object o in _inList) { ! if (o.Equals(inputValue)) { return true; Index: IsMatch.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/Dynamic/Predicates/IsMatch.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IsMatch.cs 1 Apr 2003 01:43:57 -0000 1.2 --- IsMatch.cs 1 Jan 2005 21:13:54 -0000 1.3 *************** *** 1,51 **** - /* - * ============================================================================ - * The Apache Software License, Version 1.1 - * ============================================================================ - * - * Copyright (C) 1999 The Apache Software Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modifica- - * tion, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. The end-user documentation included with the redistribution, if any, must - * include the following acknowledgment: "This product includes software - * developed by the Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, if - * and wherever such third-party acknowledgments normally appear. - * - * 4. The names "log4j" and "Apache Software Foundation" must not be used to - * endorse or promote products derived from this software without prior - * written permission. For written permission, please contact - * ap...@ap.... - * - * 5. Products derived from this software may not be called "Apache", nor may - * "Apache" appear in their name, without prior written permission of the - * Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- - * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * on behalf of the Apache Software Foundation. For more information on the - * Apache Software Foundation, please see <http://www.apache.org/>. - * - */ - using System; using System.Text.RegularExpressions; --- 1,2 ---- *************** *** 53,77 **** namespace DotNetMock.Dynamic.Predicates { public class IsMatch : IPredicate { ! private Regex regex; ! public IsMatch(Regex regex) { ! this.regex = regex; ! } ! ! public IsMatch(String regex) : this(new Regex(regex)) ! { ! } ! ! public IsMatch(String regex, bool ignoreCase) : ! this(new Regex(regex, ignoreCase ? RegexOptions.IgnoreCase : RegexOptions.None)) ! { } ! ! public bool Eval(object currentValue) { ! return currentValue == null ? false : regex.IsMatch(currentValue.ToString()); } } --- 4,40 ---- namespace DotNetMock.Dynamic.Predicates { + /// <summary> + /// <see cref="IPredicate"/> that compares the input value against an regular expression pattern. + /// </summary> public class IsMatch : IPredicate { ! private Regex _regex; ! /// <summary> ! /// Default Constructor ! /// </summary> ! /// <param name="regex">Regular expression object to use.</param> public IsMatch(Regex regex) { ! this._regex = regex; } ! /// <summary> ! /// Default Constructor ! /// </summary> ! /// <param name="regex">Regular expression pattern to use.</param> ! public IsMatch(String regex) : this(new Regex(regex)) {} ! /// <summary> ! /// Default Constructor ! /// </summary> ! /// <param name="regex">Regular expression pattern to use.</param> ! /// <param name="ignoreCase">Flag indicating if the regular expression object should ignore case or not.</param> ! public IsMatch(String regex, bool ignoreCase) : this(new Regex(regex, ignoreCase ? RegexOptions.IgnoreCase : RegexOptions.None)) {} ! /// <summary> ! /// Evaluates the input value against the provided regular expression ! /// </summary> ! /// <param name="inputValue">input value</param> ! /// <returns>True if the regular expression matches the input value, flase otherwise.</returns> ! public bool Eval(object inputValue) { ! return inputValue == null ? false : _regex.IsMatch(inputValue.ToString()); } } Index: NotEqual.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/Dynamic/Predicates/NotEqual.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** NotEqual.cs 1 Apr 2003 01:43:57 -0000 1.2 --- NotEqual.cs 1 Jan 2005 21:13:54 -0000 1.3 *************** *** 1,67 **** - /* - * ============================================================================ - * The Apache Software License, Version 1.1 - * ============================================================================ - * - * Copyright (C) 1999 The Apache Software Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modifica- - * tion, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. The end-user documentation included with the redistribution, if any, must - * include the following acknowledgment: "This product includes software - * developed by the Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, if - * and wherever such third-party acknowledgments normally appear. - * - * 4. The names "log4j" and "Apache Software Foundation" must not be used to - * endorse or promote products derived from this software without prior - * written permission. For written permission, please contact - * ap...@ap.... - * - * 5. Products derived from this software may not be called "Apache", nor may - * "Apache" appear in their name, without prior written permission of the - * Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- - * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * on behalf of the Apache Software Foundation. For more information on the - * Apache Software Foundation, please see <http://www.apache.org/>. - * - */ - - using System; - namespace DotNetMock.Dynamic.Predicates { public class NotEqual : IPredicate { private IPredicate p; ! public NotEqual(object compare) { p = new NotPredicate(new IsEqual(compare)); } ! ! public bool Eval(object currentValue) { ! return p.Eval(currentValue); } } --- 1,26 ---- namespace DotNetMock.Dynamic.Predicates { + /// <summary> + /// <see cref="IPredicate"/> that verifies the input value is not equal to the original value. + /// </summary> public class NotEqual : IPredicate { private IPredicate p; ! /// <summary> ! /// Default Constructor ! /// </summary> ! /// <param name="compare">original value to compare against</param> public NotEqual(object compare) { p = new NotPredicate(new IsEqual(compare)); } ! /// <summary> ! /// Evaluates the input value against the original value. ! /// </summary> ! /// <param name="inputValue">input value</param> ! /// <returns>True if the input value does not equal the original value, false otherwise.</returns> ! public bool Eval(object inputValue) { ! return p.Eval(inputValue); } } Index: IsEqual.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/Dynamic/Predicates/IsEqual.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** IsEqual.cs 23 Jul 2004 21:51:05 -0000 1.4 --- IsEqual.cs 1 Jan 2005 21:13:54 -0000 1.5 *************** *** 3,37 **** namespace DotNetMock.Dynamic.Predicates { public class IsEqual : IPredicate { ! private object compare; ! public IsEqual(object compare) { ! this.compare = compare; } ! ! public bool Eval(object currentValue) { ! if ( ( currentValue == null ) & ( compare != null ) ) { return false; } ! if ( ( currentValue != null ) & ( compare == null ) ) { return false; } ! if ( ( currentValue == null ) & ( compare == null ) ) { return true; } ! if ( compare.GetType().IsArray ) { ! if ( ! currentValue.GetType().IsArray ) { return false; } ! object[] currentArray = (object[]) currentValue; ! object[] compareArray = (object[]) compare; if ( compareArray.Length != currentArray.Length ) { --- 3,47 ---- namespace DotNetMock.Dynamic.Predicates { + /// <summary> + /// <see cref="IPredicate"/> comparing two values + /// </summary> public class IsEqual : IPredicate { ! private object _compare; ! /// <summary> ! /// Default Constructor ! /// </summary> ! /// <param name="compare">value to compare against</param> public IsEqual(object compare) { ! _compare = compare; } ! /// <summary> ! /// Evaluates input value against original value for equality ! /// </summary> ! /// <param name="inputValue">input value</param> ! /// <returns>True if input value equals original value, false otherwise.</returns> ! public bool Eval(object inputValue) { ! if ( ( inputValue == null ) & ( _compare != null ) ) { return false; } ! if ( ( inputValue != null ) & ( _compare == null ) ) { return false; } ! if ( ( inputValue == null ) & ( _compare == null ) ) { return true; } ! if ( _compare.GetType().IsArray ) { ! if ( ! inputValue.GetType().IsArray ) { return false; } ! object[] currentArray = (object[]) inputValue; ! object[] compareArray = (object[]) _compare; if ( compareArray.Length != currentArray.Length ) { *************** *** 49,53 **** else { ! return compare.Equals(currentValue); } } --- 59,63 ---- else { ! return _compare.Equals(inputValue); } } Index: IsEqualIgnoreCase.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/Dynamic/Predicates/IsEqualIgnoreCase.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IsEqualIgnoreCase.cs 1 Apr 2003 01:43:57 -0000 1.2 --- IsEqualIgnoreCase.cs 1 Jan 2005 21:13:54 -0000 1.3 *************** *** 1,68 **** - /* - * ============================================================================ - * The Apache Software License, Version 1.1 - * ============================================================================ - * - * Copyright (C) 1999 The Apache Software Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modifica- - * tion, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. The end-user documentation included with the redistribution, if any, must - * include the following acknowledgment: "This product includes software - * developed by the Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, if - * and wherever such third-party acknowledgments normally appear. - * - * 4. The names "log4j" and "Apache Software Foundation" must not be used to - * endorse or promote products derived from this software without prior - * written permission. For written permission, please contact - * ap...@ap.... - * - * 5. Products derived from this software may not be called "Apache", nor may - * "Apache" appear in their name, without prior written permission of the - * Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- - * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * on behalf of the Apache Software Foundation. For more information on the - * Apache Software Foundation, please see <http://www.apache.org/>. - * - */ - - using System; using System.Globalization; namespace DotNetMock.Dynamic.Predicates { public class IsEqualIgnoreCase : IPredicate { ! private IPredicate p; ! public IsEqualIgnoreCase(object compare) { ! p = new IsEqual(compare.ToString().ToLower(CultureInfo.CurrentCulture)); } ! ! public bool Eval(object currentValue) { ! return p.Eval(currentValue.ToString().ToLower(CultureInfo.CurrentCulture)); } } --- 1,28 ---- using System.Globalization; namespace DotNetMock.Dynamic.Predicates { + /// <summary> + /// <see cref="IPredicate"/> comparing strings while ignoring case + /// </summary> public class IsEqualIgnoreCase : IPredicate { ! private IPredicate _originalPredicate; ! /// <summary> ! /// Default Constructor ! /// </summary> ! /// <param name="compare">Value to compare against</param> public IsEqualIgnoreCase(object compare) { ! _originalPredicate = new IsEqual(compare.ToString().ToLower(CultureInfo.CurrentCulture)); } ! /// <summary> ! /// Evaluates input value against original value, ignoring case. ! /// </summary> ! /// <param name="inputValue">Input value</param> ! /// <returns>True if input value equals original value</returns> ! public bool Eval(object inputValue) { ! return _originalPredicate.Eval(inputValue.ToString().ToLower(CultureInfo.CurrentCulture)); } } Index: NotNull.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/Dynamic/Predicates/NotNull.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** NotNull.cs 1 Apr 2003 01:43:57 -0000 1.2 --- NotNull.cs 1 Jan 2005 21:13:54 -0000 1.3 *************** *** 1,60 **** - /* - * ============================================================================ - * The Apache Software License, Version 1.1 - * ============================================================================ - * - * Copyright (C) 1999 The Apache Software Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modifica- - * tion, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. The end-user documentation included with the redistribution, if any, must - * include the following acknowledgment: "This product includes software - * developed by the Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, if - * and wherever such third-party acknowledgments normally appear. - * - * 4. The names "log4j" and "Apache Software Foundation" must not be used to - * endorse or promote products derived from this software without prior - * written permission. For written permission, please contact - * ap...@ap.... - * - * 5. Products derived from this software may not be called "Apache", nor may - * "Apache" appear in their name, without prior written permission of the - * Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- - * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * on behalf of the Apache Software Foundation. For more information on the - * Apache Software Foundation, please see <http://www.apache.org/>. - * - */ - - using System; - namespace DotNetMock.Dynamic.Predicates { public class NotNull : IPredicate { ! public bool Eval(object currentValue) { ! return currentValue != null; } } --- 1,17 ---- namespace DotNetMock.Dynamic.Predicates { + /// <summary> + /// <see cref="IPredicate"/> that verifies that the input value is null. Opposite of <see cref="IsNull"/>. + /// </summary> public class NotNull : IPredicate { ! /// <summary> ! /// Evaluates the input value against the original value. ! /// </summary> ! /// <param name="inputValue">input value</param> ! /// <returns>True if the input value is not null, false otherwise.</returns> ! public bool Eval(object inputValue) { ! return inputValue != null; } } Index: Predicate.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/Dynamic/Predicates/Predicate.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Predicate.cs 1 Apr 2003 01:43:57 -0000 1.2 --- Predicate.cs 1 Jan 2005 21:13:54 -0000 1.3 *************** *** 1,68 **** - /* - * ============================================================================ - * The Apache Software License, Version 1.1 - * ============================================================================ - * - * Copyright (C) 1999 The Apache Software Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modifica- - * tion, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. The end-user documentation included with the redistribution, if any, must - * include the following acknowledgment: "This product includes software - * developed by the Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, if - * and wherever such third-party acknowledgments normally appear. - * - * 4. The names "log4j" and "Apache Software Foundation" must not be used to - * endorse or promote products derived from this software without prior - * written permission. For written permission, please contact - * ap...@ap.... - * - * 5. Products derived from this software may not be called "Apache", nor may - * "Apache" appear in their name, without prior written permission of the - * Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- - * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * on behalf of the Apache Software Foundation. For more information on the - * Apache Software Foundation, please see <http://www.apache.org/>. - * - */ - - using System; - namespace DotNetMock.Dynamic.Predicates { public class Predicate : IPredicate { ! public delegate bool Method(object currentValue); ! private Method m; ! public Predicate(Method m) { ! this.m = m; } ! public bool Eval(object currentValue) { ! return m(currentValue); } } --- 1,31 ---- namespace DotNetMock.Dynamic.Predicates { + /// <summary> + /// <see cref="IPredicate"/> that accepts a reference to the a delegate instance that performs the evaluation. + /// </summary> public class Predicate : IPredicate { ! /// <summary> ! /// Delegate that will perform the evaluation of the input value. ! /// </summary> ! public delegate bool EvaluationMethod(object currentValue); ! private EvaluationMethod _evaluationMethod; ! /// <summary> ! /// Default Constructor ! /// </summary> ! /// <param name="m">Delegate Reference</param> ! public Predicate(EvaluationMethod m) { ! this._evaluationMethod = m; } ! /// <summary> ! /// Evaluates the input value using the delegate method supplied. ! /// </summary> ! /// <param name="currentValue">input value</param> ! /// <returns>The results of the delegation methods evaluation</returns> public bool Eval(object currentValue) { ! return _evaluationMethod(currentValue); } } Index: NotPredicate.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/Dynamic/Predicates/NotPredicate.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** NotPredicate.cs 1 Apr 2003 01:43:57 -0000 1.2 --- NotPredicate.cs 1 Jan 2005 21:13:54 -0000 1.3 *************** *** 1,67 **** - /* - * ============================================================================ - * The Apache Software License, Version 1.1 - * ============================================================================ - * - * Copyright (C) 1999 The Apache Software Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modifica- - * tion, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. The end-user documentation included with the redistribution, if any, must - * include the following acknowledgment: "This product includes software - * developed by the Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, if - * and wherever such third-party acknowledgments normally appear. - * - * 4. The names "log4j" and "Apache Software Foundation" must not be used to - * endorse or promote products derived from this software without prior - * written permission. For written permission, please contact - * ap...@ap.... - * - * 5. Products derived from this software may not be called "Apache", nor may - * "Apache" appear in their name, without prior written permission of the - * Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- - * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * on behalf of the Apache Software Foundation. For more information on the - * Apache Software Foundation, please see <http://www.apache.org/>. - * - */ - - using System; - namespace DotNetMock.Dynamic.Predicates { public class NotPredicate : IPredicate { ! private IPredicate p; ! ! public NotPredicate(IPredicate p) { ! this.p = p; } ! ! public bool Eval(object currentValue) { ! return !p.Eval(currentValue); } } --- 1,26 ---- namespace DotNetMock.Dynamic.Predicates { + /// <summary> + /// <see cref="IPredicate"/> that is used to wrap other <see cref="IPredicate"/> objects, and invert their results. + /// </summary> public class NotPredicate : IPredicate { ! private IPredicate _wrappedPredicate; ! /// <summary> ! /// Default Constructor ! /// </summary> ! /// <param name="wrappedPredicate">original <see cref="IPredicate"/> to wrap.</param> ! public NotPredicate(IPredicate wrappedPredicate) { ! _wrappedPredicate = wrappedPredicate; } ! /// <summary> ! /// Evaluates the input value against the original value. ! /// </summary> ! /// <param name="inputValue">input value</param> ! /// <returns>The opposite ( ! ) of the original <see cref="IPredicate"/>s evaluation.</returns> ! public bool Eval(object inputValue) { ! return !_wrappedPredicate.Eval(inputValue); } } Index: IsCloseTo.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/Dynamic/Predicates/IsCloseTo.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** IsCloseTo.cs 24 Jul 2004 13:45:14 -0000 1.3 --- IsCloseTo.cs 1 Jan 2005 21:13:54 -0000 1.4 *************** *** 4,19 **** namespace DotNetMock.Dynamic.Predicates { public class IsCloseTo : IPredicate { ! ! private double expected; ! private double error; ! public IsCloseTo(double expected, double error) { ! this.expected = expected; ! this.error = error; } ! public bool Eval(object currentValue) { --- 4,29 ---- namespace DotNetMock.Dynamic.Predicates { + /// <summary> + /// <see cref="IPredicate"/> representing a expected value, but also an acceptable delta for the input value + /// </summary> public class IsCloseTo : IPredicate { ! private double _expected; ! private double _error; ! /// <summary> ! /// Default constructor ! /// </summary> ! /// <param name="expected">Expected value</param> ! /// <param name="error">Acceptable delta for input value.</param> public IsCloseTo(double expected, double error) { ! _expected = expected; ! _error = error; } ! /// <summary> ! /// Evalutates input value against any available delta ! /// </summary> ! /// <param name="currentValue">Input value to evaluate</param> ! /// <returns>True if the input value is within acceptable range.</returns> public bool Eval(object currentValue) { *************** *** 21,25 **** { double actual = Convert.ToDouble(currentValue, CultureInfo.CurrentCulture); ! return Math.Abs(actual - expected) <= error; } catch (FormatException) --- 31,35 ---- { double actual = Convert.ToDouble(currentValue, CultureInfo.CurrentCulture); ! return Math.Abs(actual - _expected) <= _error; } catch (FormatException) Index: IsAnything.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/Dynamic/Predicates/IsAnything.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** IsAnything.cs 24 Jul 2004 13:45:14 -0000 1.3 --- IsAnything.cs 1 Jan 2005 21:13:54 -0000 1.4 *************** *** 3,8 **** --- 3,16 ---- namespace DotNetMock.Dynamic.Predicates { + /// <summary> + /// <see cref="IPredicate"/> representing any value + /// </summary> public class IsAnything : IPredicate { + /// <summary> + /// Always evaluates to tue + /// </summary> + /// <param name="currentValue">INput value to evaluate</param> + /// <returns>True</returns> public bool Eval(object currentValue) { Index: IsNull.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/Dynamic/Predicates/IsNull.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IsNull.cs 1 Apr 2003 01:43:57 -0000 1.2 --- IsNull.cs 1 Jan 2005 21:13:54 -0000 1.3 *************** *** 1,60 **** - /* - * ============================================================================ - * The Apache Software License, Version 1.1 - * ============================================================================ - * - * Copyright (C) 1999 The Apache Software Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modifica- - * tion, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. The end-user documentation included with the redistribution, if any, must - * include the following acknowledgment: "This product includes software - * developed by the Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, if - * and wherever such third-party acknowledgments normally appear. - * - * 4. The names "log4j" and "Apache Software Foundation" must not be used to - * endorse or promote products derived from this software without prior - * written permission. For written permission, please contact - * ap...@ap.... - * - * 5. Products derived from this software may not be called "Apache", nor may - * "Apache" appear in their name, without prior written permission of the - * Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- - * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * on behalf of the Apache Software Foundation. For more information on the - * Apache Software Foundation, please see <http://www.apache.org/>. - * - */ - - using System; - namespace DotNetMock.Dynamic.Predicates { public class IsNull : IPredicate { ! public bool Eval(object currentValue) { ! return currentValue == null; } } --- 1,17 ---- namespace DotNetMock.Dynamic.Predicates { + /// <summary> + /// <see cref="IPredicate"/> that indicates that the input value should be null. + /// </summary> public class IsNull : IPredicate { ! /// <summary> ! /// Evaluates the input value against null ! /// </summary> ! /// <param name="inputValue">input value</param> ! /// <returns>True if the input value is null, false otherwise.</returns> ! public bool Eval(object inputValue) { ! return inputValue == null; } } Index: IsEqualIgnoreWhiteSpace.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/Dynamic/Predicates/IsEqualIgnoreWhiteSpace.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IsEqualIgnoreWhiteSpace.cs 1 Apr 2003 01:43:57 -0000 1.2 --- IsEqualIgnoreWhiteSpace.cs 1 Jan 2005 21:13:54 -0000 1.3 *************** *** 1,51 **** - /* - * ============================================================================ - * The Apache Software License, Version 1.1 - * ============================================================================ - * - * Copyright (C) 1999 The Apache Software Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modifica- - * tion, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. The end-user documentation included with the redistribution, if any, must - * include the following acknowledgment: "This product includes software - * developed by the Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, if - * and wherever such third-party acknowledgments normally appear. - * - * 4. The names "log4j" and "Apache Software Foundation" must not be used to - * endorse or promote products derived from this software without prior - * written permission. For written permission, please contact - * ap...@ap.... - * - * 5. Products derived from this software may not be called "Apache", nor may - * "Apache" appear in their name, without prior written permission of the - * Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- - * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * on behalf of the Apache Software Foundation. For more information on the - * Apache Software Foundation, please see <http://www.apache.org/>. - * - */ - using System; using System.Text; --- 1,2 ---- *************** *** 53,75 **** namespace DotNetMock.Dynamic.Predicates { public class IsEqualIgnoreWhiteSpace : IPredicate { ! private IPredicate p; ! public IsEqualIgnoreWhiteSpace(object compare) { ! p = new IsEqual(StripSpace(compare.ToString())); } ! ! public bool Eval(object currentValue) { ! return p.Eval(StripSpace(currentValue.ToString())); } ! ! public static string StripSpace(string s) { StringBuilder result = new StringBuilder(); bool lastWasSpace = true; ! foreach(char c in s) { if (Char.IsWhiteSpace(c)) --- 4,40 ---- namespace DotNetMock.Dynamic.Predicates { + /// <summary> + /// <see cref="IPredicate"/> comparing string values that ignore whitespace. + /// </summary> public class IsEqualIgnoreWhiteSpace : IPredicate { ! private IPredicate _originalPredicate; ! /// <summary> ! /// Default Constructor ! /// </summary> ! /// <param name="compare">original value to compare against</param> public IsEqualIgnoreWhiteSpace(object compare) { ! _originalPredicate = new IsEqual(StripSpace(compare.ToString())); } ! /// <summary> ! /// Evaluates the inputValue against the original, ignoring any white space encountered. ! /// </summary> ! /// <param name="inputValue">input value to compare</param> ! /// <returns>True if the input value equals the original value, false otherwise</returns> ! public bool Eval(object inputValue) { ! return _originalPredicate.Eval(StripSpace(inputValue.ToString())); } ! /// <summary> ! /// Strips any whitespace from the input string ! /// </summary> ! /// <param name="inputString">input string</param> ! /// <returns>input string, with whitespace removed</returns> ! public static string StripSpace(string inputString) { StringBuilder result = new StringBuilder(); bool lastWasSpace = true; ! foreach(char c in inputString) { if (Char.IsWhiteSpace(c)) Index: NotIn.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/Dynamic/Predicates/NotIn.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** NotIn.cs 1 Apr 2003 01:43:57 -0000 1.2 --- NotIn.cs 1 Jan 2005 21:13:54 -0000 1.3 *************** *** 1,67 **** - /* - * ============================================================================ - * The Apache Software License, Version 1.1 - * ============================================================================ - * - * Copyright (C) 1999 The Apache Software Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modifica- - * tion, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. The end-user documentation included with the redistribution, if any, must - * include the following acknowledgment: "This product includes software - * developed by the Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, if - * and wherever such third-party acknowledgments normally appear. - * - * 4. The names "log4j" and "Apache Software Foundation" must not be used to - * endorse or promote products derived from this software without prior - * written permission. For written permission, please contact - * ap...@ap.... - * - * 5. Products derived from this software may not be called "Apache", nor may - * "Apache" appear in their name, without prior written permission of the - * Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- - * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * on behalf of the Apache Software Foundation. For more information on the - * Apache Software Foundation, please see <http://www.apache.org/>. - * - */ - - using System; - namespace DotNetMock.Dynamic.Predicates { public class NotIn : IPredicate { private IPredicate p; ! public NotIn(params object[] inList) { p = new NotPredicate(new IsIn(inList)); } ! ! public bool Eval(object currentValue) { ! return p.Eval(currentValue); } } --- 1,26 ---- namespace DotNetMock.Dynamic.Predicates { + /// <summary> + /// <see cref="IPredicate"/> to verify that the input value is not in the original list of values. Opposite of <see cref="IsIn"/>. + /// </summary> public class NotIn : IPredicate { private IPredicate p; ! /// <summary> ! /// Default Constructor ! /// </summary> ! /// <param name="inList">original list of values</param> public NotIn(params object[] inList) { p = new NotPredicate(new IsIn(inList)); } ! /// <summary> ! /// Evaluates the input value against the original value. ! /// </summary> ! /// <param name="inputValue">input value</param> ! /// <returns>True if the input value is not in the original array of values, false otherwise.</returns> ! public bool Eval(object inputValue) { ! return p.Eval(inputValue); } } Index: OrPredicate.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/Dynamic/Predicates/OrPredicate.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** OrPredicate.cs 1 Apr 2003 01:43:57 -0000 1.2 --- OrPredicate.cs 1 Jan 2005 21:13:54 -0000 1.3 *************** *** 1,68 **** - /* - * ============================================================================ - * The Apache Software License, Version 1.1 - * ============================================================================ - * - * Copyright (C) 1999 The Apache Software Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modifica- - * tion, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. The end-user documentation included with the redistribution, if any, must - * include the following acknowledgment: "This product includes software - * developed by the Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, if - * and wherever such third-party acknowledgments normally appear. - * - * 4. The names "log4j" and "Apache Software Foundation" must not be used to - * endorse or promote products derived from this software without prior - * written permission. For written permission, please contact - * ap...@ap.... - * - * 5. Products derived from this software may not be called "Apache", nor may - * "Apache" appear in their name, without prior written permission of the - * Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- - * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * on behalf of the Apache Software Foundation. For more information on the - * Apache Software Foundation, please see <http://www.apache.org... [truncated message content] |