Example #1
0
        public void ClothesMain_Equal_Ok()
        {
            const int     id          = 1;
            const string  name        = "Полушубок";
            const string  description = "Полушубок красивый";
            const decimal price       = (decimal)0.55;
            var           images      = new List <IClothesImageDomain> {
                new ClothesImageDomain(1, Resources.TestImage, true)
            };
            var gender      = new GenderDomain(GenderType.Male, "Мужик");
            var clothesType = new ClothesTypeDomain("Тряпье нательное", SizeType.American, "Тряпье");
            var colors      = new List <IColorDomain> {
                new ColorDomain("Бежевый")
            };
            var sizes = new List <ISizeDomain> {
                new SizeDomain(SizeType.American, "1")
            };
            var sizeGroups = new List <ISizeGroupMainDomain> {
                new SizeGroupMainDomain(ClothesSizeType.Shirt, 1, sizes)
            };
            var clothes = new ClothesMainDomain(id, name, description, price, images, gender, clothesType, colors, sizeGroups);

            int clothesHash = HashCode.Combine(HashCode.Combine(id, name, price, description),
                                               gender.GetHashCode(), clothesType.GetHashCode(),
                                               colors.GetHashCodes(), sizeGroups.GetHashCodes());

            Assert.Equal(clothesHash, clothes.GetHashCode());
        }
Example #2
0
        public void ClothesType_Equal_Ok()
        {
            const string   name              = "Свитер";
            const SizeType sizeTypeDefault   = SizeType.American;
            const string   categoryName      = "Нательное";
            var            clothesTypeDomain = new ClothesTypeDomain(name, sizeTypeDefault, categoryName);

            int clothesTypeHash = HashCode.Combine(name, categoryName);

            Assert.Equal(clothesTypeHash, clothesTypeDomain.GetHashCode());
        }