コード例 #1
0
        public void ReturnTrueIfSerialNumberIsDuplicate()
        {
            //Arrange
            var context = GetPopulatedInMemoryDbContext();

            PhysicalItemsRepository sut = new PhysicalItemsRepository(context);

            //Act
            var isDuplicated = sut.IsSerialNumberDuplicate(duplicateSerialNumber);

            //Assert
            Assert.True(isDuplicated);
        }
コード例 #2
0
        public void ReturnNullIfLocationIdIsInvalid()
        {
            //Arrange
            var context = GetPopulatedInMemoryDbContext();

            PhysicalItemsRepository sut = new PhysicalItemsRepository(context);

            //Act
            var returnedLocation = sut.GetLocation(validLocationId);

            //Assert
            Assert.Null(returnedLocation);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }