public void RemoveClientById_PassNonExistingClientId_ReturnsSameTable() { IClientDAL clientDAL = new ClientDAL(new DBService(new DbConnectionService(_connectionStringName))); IEnumerable <IClient> clientList = clientDAL.GetClients(); int oldCount = clientList.Count(); bool isClientDeleted = clientDAL.RemoveClientById(Guid.NewGuid()); int newCount = clientDAL.GetClients().Count(); Assert.IsTrue(!isClientDeleted && newCount == oldCount); }
public void RemoveClientById_PassExistingClientId_ReturnsTableWithoutDeletedClient() { IClientDAL clientDAL = new ClientDAL(new DBService(new DbConnectionService(_connectionStringName))); IEnumerable <IClient> clientList = clientDAL.GetClients(); int oldCount = clientList.Count(); bool isClientDeleted = clientDAL.RemoveClientById(DbSeeder.TestClientId); int newCount = clientDAL.GetClients().Count(); Assert.IsTrue(isClientDeleted && newCount == oldCount - 1); }
public void AddClient_PassNewClient_ReturnsTableWithAddedClient() { IClientDAL clientDAL = new ClientDAL(new DBService(new DbConnectionService(_connectionStringName))); IEnumerable <IClient> clientList = clientDAL.GetClients(); int oldCount = clientList.Count(); Guid id = Guid.NewGuid(); clientDAL.AddClient(new Client(id, "Namex")); List <IClient> newList = clientDAL.GetClients().ToList(); bool isNewClientFound = newList.FindIndex(client => client.Id == id) > -1; Assert.IsTrue(isNewClientFound && newList.Count() == oldCount + 1); }
public void GetClients_GetClientsFromNonEmptyTable_ReturnsTableWithList() { IClientDAL clientDAL = new ClientDAL(new DBService(new DbConnectionService(_connectionStringName))); List <IClient> clientList = clientDAL.GetClients().ToList(); Assert.IsTrue(clientList.Count() == DbSeeder.clientList.Count()); }
public void GetClients_GetClientsFromEmptyTable_ReturnsEmptyTable() { _dbSeeder.EmptyTables(); IClientDAL clientDAL = new ClientDAL(new DBService(new DbConnectionService(_connectionStringName))); IEnumerable <IClient> clientList = clientDAL.GetClients(); Assert.IsTrue(clientList.Count() == 0); }
public void UpdateClientById_PassValidClientObject_ReturnsTableWithUpdatedClient() { IClientDAL clientDAL = new ClientDAL(new DBService(new DbConnectionService(_connectionStringName))); IClient newClient = new Client(DbSeeder.TestClientId, "Foo", "Addr"); clientDAL.UpdateClientById(newClient); List <IClient> updatedList = clientDAL.GetClients().ToList(); IClient updatedClient = updatedList.Find(client => client.Id == DbSeeder.TestClientId); Assert.IsTrue(updatedClient.Name == "Foo" && updatedClient.Address == "Addr"); }
internal ObservableCollection <Client> GetAllClients() { return(clientDAL.GetClients()); }