public void DeleteFromDatabase_PaymentToDelete_CorrectlyDelete() { var payment = new Payment { Note = "paymentToDelete" }; var dataAccess = new PaymentDataAccess(connectionCreator); dataAccess.SaveItem(payment); Assert.IsTrue(dataAccess.LoadList(x => x.Id == payment.Id).Any()); dataAccess.DeleteItem(payment); Assert.IsFalse(dataAccess.LoadList(x => x.Id == payment.Id).Any()); }
public void SaveToDatabase_CreateAndUpdatePayment_CorrectlyUpdated() { var firstAmount = 5555555; var secondAmount = 222222222; var payment = new Payment { Amount = firstAmount }; var dataAccess = new PaymentDataAccess(connectionCreator); dataAccess.SaveItem(payment); Assert.AreEqual(firstAmount, dataAccess.LoadList().FirstOrDefault(x => x.Id == payment.Id).Amount); payment.Amount = secondAmount; dataAccess.SaveItem(payment); var categories = dataAccess.LoadList(); Assert.IsFalse(categories.Any(x => Math.Abs(x.Amount - firstAmount) < 0.1)); Assert.AreEqual(secondAmount, categories.First(x => x.Id == payment.Id).Amount); }
public void DeleteFromDatabase_PaymentToDelete_CorrectlyDelete() { var payment = new Payment { Note = "paymentToDelete", }; var dataAccess = new PaymentDataAccess(connectionCreator); dataAccess.SaveItem(payment); Assert.IsTrue(dataAccess.LoadList(x => x.Id == payment.Id).Any()); dataAccess.DeleteItem(payment); Assert.IsFalse(dataAccess.LoadList(x => x.Id == payment.Id).Any()); }