コード例 #1
0
            public void should_mark_as_a_new_with_newly_generated_identity_field()
            {
                //act
                var result = Repository.Insert(new TestEntity()
                {
                    Field = "Great!"
                });

                //assert
                A.CallTo(() => SessionScope.MarkAsNew(A <TestEntity> .That.Matches(t => t.Id == 777 && t.Field == "Great!"))).MustHaveHappened(Repeated.Exactly.Once);
                result.Id.Should().Be(777);
                result.Field.Should().Be("Great!");
            }
コード例 #2
0
            public void should_mark_as_a_new_leaving_identity_field_without_value_because_identity_generator_has_been_configured()
            {
                //act
                var result = Repository.Insert(new TestEntity()
                {
                    Field = "Great!"
                });

                //assert
                A.CallTo(() => SessionScope.MarkAsNew(A <TestEntity> .That.Matches(t => t.Id == 0 && t.Field == "Great!"))).MustHaveHappened(Repeated.Exactly.Once);
                result.Id.Should().Be(0);
                result.Field.Should().Be("Great!");
            }