示例#1
0
 public void Should_ignore_extra_properties_on_actual_object_when_matching()
 {
     _actual = new Customer {
         Name = ExpectedName, PhoneNumber = "1234567890"
     };
     _expected = new { Name = ExpectedName }.ToExpectedObject();
     _expected.ShouldMatch(_actual);
 }
示例#2
0
 public void Should_flag_uninitialized_properties_on_actual_object_as_unequal()
 {
     _actual = new Customer {
         Name = ExpectedName
     };
     _expected = new { Name = ExpectedName, PhoneNumber = "1234567890" }.ToExpectedObject();
     _expected.ShouldEqual(_actual);
 }
示例#3
0
        public void CheckTheAdapterFunctionality()
        {
            var i         = new ImmutableObject();
            var exGuy     = new ExpectedObject(i);
            var exContext = new ExpectedContext();

            exContext.Use(exGuy);
            Assert.Equal(i.DoSomething(), exGuy.DoAnotherSomething());
        }
示例#4
0
 /// <summary>
 /// Creates the instance of the constraint.
 /// </summary>
 /// <param name="expected">The object to match the actual value against.</param>
 public MatchingConstraint(object expected)
 {
     _writer   = new ExposingWriter(new ShouldWriter());
     _expected = expected.ToExpectedObject().Configure(ctx =>
     {
         ctx.IgnoreTypes();
         ctx.SetWriter(_writer);
     });
 }
示例#5
0
 private static bool ShouldMatch(ExpectedObject expected, object o)
 {
     try
     {
         expected.ShouldMatch(o);
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
示例#6
0
 public static int ReturnValueA([FormatterValueConverter(typeof(TestToExpectedObjectConverter))] ExpectedObject value)
 {
     return(value.No);
 }
示例#7
0
 public static int ReturnValue(ExpectedObject value)
 {
     return(value.No);
 }
 public void Use(ExpectedObject obj)
 {
     obj.DoAnotherSomething();
 }
示例#9
0
 public static ExpectedObject AddTreeNode(this ExpectedObject eo)
 {
     return(eo.Configure(context => context.PushStrategy <TreeNodeComparisonStrategy>()));
 }