public void IsGivenADescription() { string description = "DESCRIPTION"; bool irrelevantFlag = false; AssertDescription.IsEqual(new AlwaysMatcher(irrelevantFlag, description), description); }
public void HasAReadableDescription() { ICloneable prototype = ACloneableObject(); AssertDescription.IsEqual(new ReturnCloneAction(prototype), "a clone of <" + prototype + ">(NMockTests.NamedObject)"); }
public void HasReadableDescription() { Exception exception = new Exception(); ThrowAction action = new ThrowAction(exception); AssertDescription.IsEqual(action, "throw <" + exception + ">(System.Exception)"); }
public void HasAReadableDescription() { object result = new NamedObject("result"); ReturnAction action = new ReturnAction(result); AssertDescription.IsEqual(action, "return <result>(NMockTests.NamedObject)"); }
public void HasAReadableDescription() { string substring = "substring"; AssertDescription.IsEqual(new StringContainsMatcher(substring), "string containing \"" + substring + "\""); }
public void HasReadableDescription() { AssertDescription.IsEqual(new ComparisonMatcher(10, -1, -1), "? < <10>(System.Int32)"); AssertDescription.IsEqual(new ComparisonMatcher(10, -1, 0), "? <= <10>(System.Int32)"); AssertDescription.IsEqual(new ComparisonMatcher(10, 0, 0), "? = <10>(System.Int32)"); AssertDescription.IsEqual(new ComparisonMatcher(10, 0, 1), "? >= <10>(System.Int32)"); AssertDescription.IsEqual(new ComparisonMatcher(10, 1, 1), "? > <10>(System.Int32)"); }
public void FormatsDescriptionToLookSimilarToAnArgumentList() { Matcher matcher = new ArgumentsMatcher( new AlwaysMatcher(true, "arg1-description"), new AlwaysMatcher(true, "arg2-description")); AssertDescription.IsEqual(matcher, "(arg1-description, arg2-description)"); }
public void DescriptionOfInvocationOfPropertySetterDoesNotShowSugaredMethod() { MethodInfo setter = typeof(SugarMethods).GetMethod("set_Property", new[] { typeof(int) }); invocation = new Invocation(receiver, setter, new object[] { 10 }); AssertDescription.IsEqual(invocation, "receiver.Property = <10>(System.Int32)\r\n"); }
public void OverridesDescriptionOfOtherMatcherWithThatPassedToConstructor() { Matcher m1 = new DescriptionOverride("m1", new AlwaysMatcher(true, "always true")); Matcher m2 = new DescriptionOverride("m2", new AlwaysMatcher(false, "always false")); AssertDescription.IsEqual(m1, "m1"); AssertDescription.IsEqual(m2, "m2"); }
public void DescribesAsIndexSetterArguments() { Matcher matcher = new IndexSetterArgumentsMatcher( new AlwaysMatcher(true, "arg1-description"), new AlwaysMatcher(true, "arg2-description")); AssertDescription.IsEqual(matcher, "[arg1-description] = (arg2-description)"); }
public void DescriptionOfInvocationOfPropertyGetterDoesNotShowSugaredMethod() { MethodInfo getter = typeof(SugarMethods).GetMethod("get_Property", new Type[0]); invocation = new Invocation(receiver, getter, new object[0]); AssertDescription.IsEqual(invocation, "receiver.Property\r\n"); }
public void HasReadableDescription() { int index = 1; object value = new NamedObject("value"); SetIndexedParameterAction action = new SetIndexedParameterAction(index, value); AssertDescription.IsEqual(action, "set arg 1=<value>(NMockTests.NamedObject)"); }
public void DescriptionOfInvocationOfIndexerSetterDoesNotShowSugaredMethod() { MethodInfo getter = typeof(SugarMethods).GetMethod( "set_Item", new[] { typeof(string), typeof(int), typeof(int) }); invocation = new Invocation(receiver, getter, new object[] { "hello", 10, 11 }); AssertDescription.IsEqual(invocation, "receiver[\"hello\", <10>(System.Int32)] = <11>(System.Int32)\r\n"); }
public void HasReadableDescription() { string name = "param"; object value = new NamedObject("value"); SetNamedParameterAction action = new SetNamedParameterAction(name, value); AssertDescription.IsEqual(action, "set param=<value>(NMockTests.NamedObject)"); }
public void HasAReadableDescription() { AssertDescription.IsEqual( new ElementMatcher(CollectionOf("a", "b", 1, 2)), "element of [\"a\", \"b\", <1>(System.Int32), <2>(System.Int32)]"); AssertDescription.IsEqual( new ElementMatcher(CollectionOf()), "element of []"); }
public void DescriptionOfEventRemoverDoesNotShowSugaredMethod() { MethodInfo adder = typeof(SugarMethods).GetMethod( "remove_Event", new[] { typeof(EventHandler) }); Delegate handler = new EventHandler(HandleEvent); invocation = new Invocation(receiver, adder, new object[] { handler }); AssertDescription.IsEqual(invocation, "receiver.Event -= <HandleEvent[System.EventHandler]>\r\n"); }
public void HasAReadableDescription() { NamedObject value = new NamedObject("value"); AssertDescription.IsEqual(new EqualMatcher(value), "equal to <" + value + ">(NMockTests.NamedObject)"); }
public void HasAReadableDescription() { Matcher matcher = new EqualMatcher("foo"); AssertDescription.IsEqual(new PropertyMatcher("A", matcher), "property 'A' " + matcher); }
public void HasAReadableDescription() { AssertDescription.IsEqual(new ResultSynthesizer(), "a synthesized result"); }
public void HasAReadableDescription() { IAction action = new FireAction("MyEvent", 123); AssertDescription.IsEqual(action, "fire MyEvent"); }
public void ShowsOutputParametersInDescription() { Matcher matcher = new ArgumentsMatcher(new AlwaysMatcher(true, "arg1"), Is.Out); AssertDescription.IsEqual(matcher, "(arg1, out)"); }
public void HasAReadableDescription() { IAction action = new CollectAction(37); AssertDescription.IsEqual(action, "collect argument at index 37"); }
public void UsesMethodNameAsDescription() { AssertDescription.IsEqual(new MethodNameMatcher("m", typeof(I)), "m"); }
public void HasAReadableDescription() { Matcher matcher = new EqualMatcher("foo"); AssertDescription.IsEqual(new FieldMatcher("A", matcher), "field 'A' " + matcher); }
public void ProvidesAReadableDescription() { AssertDescription.IsEqual(new NullMatcher(), "null"); }