コード例 #1
0
        public void ValidSortWarehouses()
        {
            //Arrange
            var stockSortService = new SortService();

            IDictionary <string, Warehouse> warehouses = new Dictionary <string, Warehouse>();

            Warehouse firstWarehouse = new Warehouse();

            firstWarehouse.Name      = "WH-A";
            firstWarehouse.Materials = new List <Material>()
            {
                new Material()
                {
                    Amount = 10, MaterialId = "COM-100001", Name = "Cherry Hardwood Arched Door - PS"
                },
                new Material()
                {
                    Amount = 10, MaterialId = "COM-123906c", Name = "Generic Wire Pull;"
                }
            };

            Warehouse secondWarehouse = new Warehouse();

            secondWarehouse.Name      = "WH-B";
            secondWarehouse.Materials = new List <Material>()
            {
                new Material()
                {
                    Amount = 10, MaterialId = "COM-100001", Name = "Cherry Hardwood Arched Door - PS"
                }
            };

            Warehouse thirdWarehouse = new Warehouse();

            thirdWarehouse.Name      = "WH-C";
            thirdWarehouse.Materials = new List <Material>()
            {
                new Material()
                {
                    Amount = 10, MaterialId = "COM-100001", Name = "Cherry Hardwood Arched Door - PS"
                }
            };

            warehouses.Add(firstWarehouse.Name, firstWarehouse);
            warehouses.Add(secondWarehouse.Name, secondWarehouse);
            warehouses.Add(thirdWarehouse.Name, thirdWarehouse);

            //Act
            var sortedwareHouses = stockSortService.SortWarehouses(warehouses);

            //Assert
            Assert.Equal(sortedwareHouses.Skip(1).Take(1).FirstOrDefault().Value, thirdWarehouse);
        }