public void Can_Perform_Add_On_LanguageRepository() { // Arrange var provider = new PetaPocoUnitOfWorkProvider(); var unitOfWork = provider.GetUnitOfWork(); var repository = new LanguageRepository(unitOfWork); // Act var languageBR = new Language("pt-BR") { CultureName = "pt-BR" }; repository.AddOrUpdate(languageBR); unitOfWork.Commit(); // Assert Assert.That(languageBR.HasIdentity, Is.True); Assert.That(languageBR.Id, Is.EqualTo(6));//With 5 existing entries the Id should be 6 }
public void Can_Perform_Update_On_LanguageRepository() { // Arrange var provider = new PetaPocoUnitOfWorkProvider(); var unitOfWork = provider.GetUnitOfWork(); var repository = new LanguageRepository(unitOfWork); // Act var language = repository.Get(5); language.IsoCode = "pt-BR"; language.CultureName = "pt-BR"; repository.AddOrUpdate(language); unitOfWork.Commit(); var languageUpdated = repository.Get(5); // Assert Assert.That(languageUpdated, Is.Not.Null); Assert.That(languageUpdated.IsoCode, Is.EqualTo("pt-BR")); Assert.That(languageUpdated.CultureName, Is.EqualTo("pt-BR")); }
public void Can_Perform_Update_On_LanguageRepository() { // Arrange var provider = new PetaPocoUnitOfWorkProvider(); var unitOfWork = provider.GetUnitOfWork(); var repository = new LanguageRepository(unitOfWork); // Act var language = repository.Get(5); language.IsoCode = "pt-BR"; language.CultureName = "pt-BR"; repository.AddOrUpdate(language); unitOfWork.Commit(); var languageUpdated = repository.Get(5); // Assert Assert.That(languageUpdated, Is.Not.Null); Assert.That(languageUpdated.IsoCode, Is.EqualTo("pt-BR")); Assert.That(languageUpdated.CultureName, Is.EqualTo("pt-BR")); }
public void Can_Perform_Add_On_LanguageRepository() { // Arrange var provider = new PetaPocoUnitOfWorkProvider(); var unitOfWork = provider.GetUnitOfWork(); var repository = new LanguageRepository(unitOfWork); // Act var languageBR = new Language("pt-BR") { CultureName = "pt-BR" }; repository.AddOrUpdate(languageBR); unitOfWork.Commit(); // Assert Assert.That(languageBR.HasIdentity, Is.True); Assert.That(languageBR.Id, Is.EqualTo(6));//With 5 existing entries the Id should be 6 }