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); }
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); }