Ejemplo n.º 1
0
            public void Should_Add_Client_Record_ToDb()
            {
                // Arrange
                string pathToFile = @"С:\Users\Dakosia\source\repos\CSharp\KazTourApp\KazTourApp.DAL\LiteDb.db";
                var    client     = new ClientRecord
                                    (
                    1,
                    "Asuna",
                    "Yuuki",
                    "1234567890",
                    "*****@*****.**"
                                    );

                ClientStorage storage = new ClientStorage();
                int           itemsCountBeforeInsert = storage.ReadAllClients().Count;

                // Act
                storage.AddClient(client);

                // Assert
                Assert.IsTrue(File.Exists(pathToFile));

                int itemsCountAfterInsert = storage.ReadAllClients().Count;

                Assert.IsTrue(itemsCountBeforeInsert == itemsCountAfterInsert - 1);
            }
Ejemplo n.º 2
0
            public void Should_Remove_Client_Record_FromDb()
            {
                // Arrange
                string        pathToFile = @"С:\Users\Dakosia\source\repos\CSharp\KazTourApp\KazTourApp.DAL\LiteDb.db";
                int           id         = 0;
                ClientStorage storage    = new ClientStorage();
                int           itemsCountBeforeDeletion = storage.ReadAllClients().Count;

                // Act
                storage.RemoveClient(id);

                // Assert
                Assert.IsTrue(File.Exists(pathToFile));

                int itemsCountAfterDeletion = storage.ReadAllClients().Count;

                Assert.IsTrue(itemsCountBeforeDeletion == itemsCountAfterDeletion + 1);
            }