public void UpdateAvailableRepositoryTest() { //Arrange IAvailableRepository repository = new AvailableRepository(); Available available = _contextForTest.Availables.Find(1); available.Name = "Forza Horizon"; available.Plataform = "Xbox 360"; available.Price = 25; available.Release = new DateTime(2014, 09, 30); available.Genre = "Race"; available.Description = "Corridas"; //Action var updatedAvailable = repository.Update(available); //Assert var persistedAvailable = _contextForTest.Availables.Find(1); Assert.IsNotNull(updatedAvailable); Assert.AreEqual(updatedAvailable.Id, persistedAvailable.Id); Assert.AreEqual(updatedAvailable.Name, persistedAvailable.Name); Assert.AreEqual(updatedAvailable.Plataform, persistedAvailable.Plataform); Assert.AreEqual(updatedAvailable.Price, persistedAvailable.Price); Assert.AreEqual(updatedAvailable.Release, persistedAvailable.Release); Assert.AreEqual(updatedAvailable.Genre, persistedAvailable.Genre); Assert.AreEqual(updatedAvailable.Description, persistedAvailable.Description); }
public void DeleteAvailableRepositoryTest() { //Arrange IAvailableRepository repository = new AvailableRepository(); //Action var deletedAvailable = repository.Delete(1); //Assert var persistedAvailable = _contextForTest.Availables.Find(1); Assert.IsNull(persistedAvailable); }
public void CreateAvailableRepositoryTest() { //Arrange Available b = ObjectMother.GetAvailable(); IAvailableRepository repository = new AvailableRepository(); //Action Available newAvailable = repository.Save(b); //Assert Assert.IsTrue(newAvailable.Id > 0); }
public void RetrieveAvailableRepositoryTest() { //Arrange IAvailableRepository repository = new AvailableRepository(); //Action Available available = repository.Get(1); //Assert Assert.IsNotNull(available); Assert.IsTrue(available.Id > 0); Assert.IsFalse(string.IsNullOrEmpty(available.Name)); Assert.IsFalse(string.IsNullOrEmpty(available.Plataform)); Assert.IsFalse(available.Price <= 0); Assert.IsFalse(string.IsNullOrEmpty(available.Genre)); }