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); }
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); }
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()); }
/// <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); }); }
private static bool ShouldMatch(ExpectedObject expected, object o) { try { expected.ShouldMatch(o); return(true); } catch (Exception) { return(false); } }
public static int ReturnValueA([FormatterValueConverter(typeof(TestToExpectedObjectConverter))] ExpectedObject value) { return(value.No); }
public static int ReturnValue(ExpectedObject value) { return(value.No); }
public void Use(ExpectedObject obj) { obj.DoAnotherSomething(); }
public static ExpectedObject AddTreeNode(this ExpectedObject eo) { return(eo.Configure(context => context.PushStrategy <TreeNodeComparisonStrategy>())); }