public void MatcheStockPosition_RangeGrowthInEmployeeSize()
        {
            var employee = new EmployeeCard {
                Sex = Sex.M
            };
            var sizeType = new SizeType {
                CategorySizeType = CategorySizeType.Size
            };
            var heightType = new SizeType {
                CategorySizeType = CategorySizeType.Height
            };
            var size52 = new Size {
                Name = "52", SizeType = sizeType, UseInEmployee = true
            };
            var height170And176 = new Size
            {
                Name = "170-176", SizeType = heightType, UseInEmployee = true
            };
            var height170 = new Size {
                Name          = "170",
                SizeType      = heightType,
                UseInEmployee = true,
                SuitableSizes = new List <Size> {
                    height170And176
                }
            };

            employee.Sizes.Add(new EmployeeSize {
                Size = height170And176, SizeType = heightType
            });
            employee.Sizes.Add(new EmployeeSize {
                Size = size52, SizeType = sizeType
            });

            var itemType = Substitute.For <ItemsType>();

            itemType.Category.Returns(ItemTypeCategory.wear);
            var nomenclature = Substitute.For <Nomenclature>();

            nomenclature.Id.Returns(25);
            nomenclature.Type.Returns(itemType);
            nomenclature.MatchingEmployeeSex(Sex.M).Returns(true);
            var protectionTools = Substitute.For <ProtectionTools>();

            protectionTools.MatchedNomenclatures.Returns(new[] { nomenclature });
            var normItem = Substitute.For <NormItem>();

            normItem.ProtectionTools.Returns(protectionTools);

            var employeeItem = new EmployeeCardItem(employee, normItem);

            var stockPosition = new StockPosition(nomenclature, 0, size52, height170);
            var result        = employeeItem.MatcheStockPosition(stockPosition);

            Assert.That(result, Is.True);
        }
        public void MatcheStockPosition_WithoutGrowthCase()
        {
            var heightType = new SizeType {
                CategorySizeType = CategorySizeType.Height
            };
            var sizeType = new SizeType {
                CategorySizeType = CategorySizeType.Size
            };
            var size = new Size {
                Name = "52", SizeType = sizeType
            };
            var itemType     = Substitute.For <ItemsType>();
            var nomenclature = Substitute.For <Nomenclature>();

            nomenclature.Type.Returns(itemType);
            nomenclature.MatchingEmployeeSex(Sex.M).Returns(true);
            var protectionTools = Substitute.For <ProtectionTools>();

            protectionTools.MatchedNomenclatures.Returns(new[] { nomenclature });
            var employee = Substitute.For <EmployeeCard>();

            employee.Sex.Returns(Sex.M);
            var sizes = new List <EmployeeSize>();

            employee.Sizes.Returns(sizes);
            employee.Sizes.Add(new EmployeeSize {
                Size = new Size {
                    Name = "182"
                }, SizeType = heightType, Employee = employee
            });
            employee.Sizes.Add(new EmployeeSize {
                Size = size, SizeType = sizeType, Employee = employee
            });
            var normItem = Substitute.For <NormItem>();

            normItem.ProtectionTools.Returns(protectionTools);

            var employeeCardItem = new EmployeeCardItem(employee, normItem);

            var stockPosition = new StockPosition(nomenclature, 0, size, null);

            Assert.That(employeeCardItem.MatcheStockPosition(stockPosition));
        }
        public bool MatcheStockPosition_ClothesSex(Sex employeeSex, ClothesSex?clothesSex)
        {
            var employee = new EmployeeCard();

            employee.Sex = employeeSex;

            var itemType     = Substitute.For <ItemsType>();
            var nomenclature = new Nomenclature {
                Id   = 25,
                Type = itemType,
                Sex  = clothesSex
            };
            var protectionTools = Substitute.For <ProtectionTools>();

            protectionTools.MatchedNomenclatures.Returns(new[] { nomenclature });
            var normItem = Substitute.For <NormItem>();

            normItem.ProtectionTools.Returns(protectionTools);
            var employeeItem = new EmployeeCardItem(employee, normItem);

            return(employeeItem.MatcheStockPosition(new StockPosition(nomenclature, 0, null, null)));
        }
        public void MatcheStockPosition_SizeTest()
        {
            var employee = new EmployeeCard();

            employee.Sex = Sex.M;
            var sizeType = new SizeType {
                CategorySizeType = CategorySizeType.Size
            };
            var size = new Size {
                Name = "52", SizeType = sizeType
            };

            employee.Sizes.Add(new EmployeeSize {
                Size = size, SizeType = sizeType, Employee = employee
            });

            var itemType = Substitute.For <ItemsType>();

            itemType.SizeType.Returns(sizeType);
            var nomenclature = Substitute.For <Nomenclature>();

            nomenclature.Id.Returns(25);
            nomenclature.Type.Returns(itemType);
            nomenclature.MatchingEmployeeSex(Sex.M).Returns(true);
            var protectionTools = Substitute.For <ProtectionTools>();

            protectionTools.MatchedNomenclatures.Returns(new[] { nomenclature });
            var normItem = Substitute.For <NormItem>();

            normItem.ProtectionTools.Returns(protectionTools);

            var employeeItem = new EmployeeCardItem(employee, normItem);

            var stockPosition = new StockPosition(nomenclature, 0, size, null);
            var result        = employeeItem.MatcheStockPosition(stockPosition);

            Assert.That(result, Is.True);
        }