public void Should_Add_Book_Record_ToDb() { // Arrange string pathToFile = @"С:\Users\Dakosia\source\repos\CSharp\KazTourApp\KazTourApp.DAL\LiteDb.db"; var booking = new BookRecord ( 1, 1, 2, 1600000, new DateTime(2018, 08, 11), new DateTime(2018, 08, 25) ); BookStorage storage = new BookStorage(); int itemsCountBeforeInsert = storage.ReadAllBookings().Count; // Act storage.AddBooking(booking); // Assert Assert.IsTrue(File.Exists(pathToFile)); int itemsCountAfterInsert = storage.ReadAllBookings().Count; Assert.IsTrue(itemsCountBeforeInsert == itemsCountAfterInsert - 1); }
public void Should_Remove_Book_Record_FromDb() { // Arrange string pathToFile = @"С:\Users\Dakosia\source\repos\CSharp\KazTourApp\KazTourApp.DAL\LiteDb.db"; int id = 0; BookStorage storage = new BookStorage(); int itemsCountBeforeDeletion = storage.ReadAllBookings().Count; // Act storage.RemoveBooking(id); // Assert Assert.IsTrue(File.Exists(pathToFile)); int itemsCountAfterDeletion = storage.ReadAllBookings().Count; Assert.IsTrue(itemsCountBeforeDeletion == itemsCountAfterDeletion + 1); }