public void ReturnTrueIfSerialNumberIsDuplicate() { //Arrange var context = GetPopulatedInMemoryDbContext(); PhysicalItemsRepository sut = new PhysicalItemsRepository(context); //Act var isDuplicated = sut.IsSerialNumberDuplicate(duplicateSerialNumber); //Assert Assert.True(isDuplicated); }
public void ReturnNullIfLocationIdIsInvalid() { //Arrange var context = GetPopulatedInMemoryDbContext(); PhysicalItemsRepository sut = new PhysicalItemsRepository(context); //Act var returnedLocation = sut.GetLocation(validLocationId); //Assert Assert.Null(returnedLocation); }
public void GiveTotalValueOfAnItem() { //Arrange var context = GetPopulatedInMemoryDbContext(); PhysicalItemsRepository sut = new PhysicalItemsRepository(context); var fakePhysicalItem1 = sut.GetById(1); //Act var totalValue = sut.GetTotalValueByInventoryItem(fakePhysicalItem1.InventoryItemId); //Assert Assert.Equal(19.98m, totalValue); }
public void RetrieveListOfPhysicalItemsByLocation() { //Arrange var context = GetPopulatedInMemoryDbContext(); PhysicalItemsRepository sut = new PhysicalItemsRepository(context); var fakePhysicalItemSameLocation1 = sut.GetById(1); var fakePhysicalItemSameLocation2 = sut.GetById(2); var fakePhysicalItemDifferentLocation = sut.GetById(3); //Act var fakeListByLocation = sut.GetByLocation(1); //Assert Assert.Contains(fakePhysicalItemSameLocation1, fakeListByLocation); Assert.Contains(fakePhysicalItemSameLocation2, fakeListByLocation); Assert.DoesNotContain(fakePhysicalItemDifferentLocation, fakeListByLocation); }