public void GetAll_RetrieveAllItems_AllItemsRetrieved() { // arrange InMemoryWarehouseRepository inmemorywarehouserepository = new InMemoryWarehouseRepository(); inmemorywarehouserepository.Add(new Warehouse(1, 10, 10)); inmemorywarehouserepository.Add(new Warehouse(1, 15, 20)); // act List<Warehouse> warehouselist = (List<Warehouse>)inmemorywarehouserepository.GetAll(); // assert Assert.AreEqual(warehouselist.Count, 2); }
public void getWarehousesByCoordinate_retrievewarehouse_itemretrieved() { // arrange InMemoryWarehouseRepository inmemorywarehouserepository = new InMemoryWarehouseRepository(); inmemorywarehouserepository.Add(new Warehouse(1, 10, 10)); inmemorywarehouserepository.Add(new Warehouse(2, 15, 20)); // act List<Warehouse> warehouselist = inmemorywarehouserepository.getWarehousesByCoordinate(15, 20); // assert Assert.AreEqual(warehouselist.Count, 1); Assert.AreEqual(warehouselist[0].Warehouseid, 2); }
public void GetByID_RetrieveItem_ItemRetrieved() { // arrange InMemoryWarehouseRepository inmemorywarehouserepository = new InMemoryWarehouseRepository(); inmemorywarehouserepository.Add(new Warehouse(1, 10, 10)); // act Warehouse warehouse = inmemorywarehouserepository.GetById(1); // assert Assert.AreEqual(warehouse.Warehouseid, 1); }
public void Delete_DeleteItem_ItemRemoved() { // arrange InMemoryWarehouseRepository inmemorywarehouserepository = new InMemoryWarehouseRepository(); inmemorywarehouserepository.Add(new Warehouse(1, 10, 10)); // act inmemorywarehouserepository.Delete(new Warehouse(1, 10, 10)); // assert Assert.IsNull(inmemorywarehouserepository.GetById(1)); }
public void Add_Item_AddedItem() { // arrange InMemoryWarehouseRepository inmemorywarehouserepository = new InMemoryWarehouseRepository(); // act inmemorywarehouserepository.Add(new Warehouse(1, 10, 10)); // assert List<Warehouse> warehouselist = (List<Warehouse>)inmemorywarehouserepository.GetAll(); Assert.AreEqual(warehouselist.Count, 1); }
public void Update_ItemCoord_UpdatedCoord() { // arrange InMemoryWarehouseRepository inmemorywarehouserepository = new InMemoryWarehouseRepository(); inmemorywarehouserepository.Add(new Warehouse(1, 10, 10)); inmemorywarehouserepository.Add(new Warehouse(2, 15, 20)); // act inmemorywarehouserepository.Update(new Warehouse(1, 15, 10)); // assert Assert.AreEqual(inmemorywarehouserepository.GetById(1).X, 15); }