コード例 #1
0
 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);
        }
コード例 #3
0
        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);
        }
コード例 #5
0
 public void UnfrozenTypeYieldsDifferentObject(Bar bar, Foo foo)
 {
     foo.Bar.Should().NotBeSameAs(bar);
 }
コード例 #6
0
 public void GeneratedCollectionIsNotEmpty(Bar bar)
 {
     bar.Quxes.Should().NotBeEmpty();
 }
コード例 #7
0
 public void GeneratedCollectionCanBeCleared(Bar bar)
 {
     bar.Quxes.Clear();
     bar.Quxes.Should().HaveCount(0);
 }