Пример #1
0
            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);
            }