コード例 #1
0
        public void ShouldSetIdOnInsertForNonDbGenerated()
        {
            //Arrange
            var  entity = new TestEntityWithGuidPk();
            Guid assignedId;

            //Act
            using (var uow = unitOfWorkManager.Begin())
            {
                testEntityWithGuidPkRepository.Insert(entity);

                //Assert: It should be set
                assignedId = entity.Id;
                assignedId.ShouldNotBe(Guid.Empty);

                uow.Complete();
            }

            //Assert: It should still be the same
            entity.Id.ShouldBe(assignedId);
        }
コード例 #2
0
        public void Should_Set_Id_On_Insert_For_Non_DbGenerated()
        {
            //Arrange
            var entity = new TestEntityWithGuidPk();
            Guid assignedId;

            //Act
            using (var uow = _unitOfWorkManager.Begin())
            {
                _testEntityWithGuidPkRepository.Insert(entity);

                //Assert: It should be set
                assignedId = entity.Id;
                assignedId.ShouldNotBe(Guid.Empty);

                uow.Complete();
            }

            //Assert: It should still be the same
            entity.Id.ShouldBe(assignedId);
        }