public void ParentShouldBeSameForCollections(Bar bar) { foreach (var qux in bar.Quxes) { (qux.Bar == bar).Should().BeTrue(); } }
public void SetsParentIdWhenPropertyExists(SUT sut, IInvocation invocation, int fooId) { var foo = new Foo() { Id = fooId }; var bar = new Bar(); invocation.InvocationTarget.Returns(foo); invocation.ReturnValue = bar; sut.Intercept(invocation); bar.FooId.Should().Be(foo.Id); }
public void SetsIdOnMatchingProperty(SUT sut, IInvocation invocation, int barId) { var foo = new Foo { BarId = barId }; var bar = new Bar(); invocation.Method.Returns(foo.GetType().GetProperty("Bar").GetGetMethod()); invocation.InvocationTarget.Returns(foo); invocation.ReturnValue = bar; sut.Intercept(invocation); bar.Id.Should().Be(barId); }
public void SetsPropertyOnValueReturn(SUT sut, IInvocation invocation) { // Setup fixture var foo = new Foo(); var bar = new Bar(); invocation.Method.Returns(foo.GetType().GetProperty("Bar").GetGetMethod()); invocation.InvocationTarget.Returns(foo); invocation.ReturnValue = bar; // Exercise system sut.Intercept(invocation); // Verify outcome foo.Bar.Should().Be(bar); }
public void UnfrozenTypeYieldsDifferentObject(Bar bar, Foo foo) { foo.Bar.Should().NotBeSameAs(bar); }
public void GeneratedCollectionIsNotEmpty(Bar bar) { bar.Quxes.Should().NotBeEmpty(); }
public void GeneratedCollectionCanBeCleared(Bar bar) { bar.Quxes.Clear(); bar.Quxes.Should().HaveCount(0); }