Example #1
0
        public void ClothesTypeMain_Equal_ClothesTypeMain()
        {
            var first  = ClothesTypeData.ClothesTypeMainDomains.First();
            var second = new ClothesTypeDomain(first.Name, first.SizeTypeDefault, first.CategoryName);

            Assert.True(first.Equals(second));
        }
Example #2
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 #3
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());
        }
        public async Task ValidateIncludes_ClothesTypeNotFound()
        {
            var clothesType     = new ClothesTypeDomain("NotFound", SizeType.Default, "NotFound");
            var clothes         = ClothesData.ClothesMainDomains.First();
            var clothesNotFound = new ClothesMainDomain(clothes, clothes.Images, clothes.Gender, clothesType,
                                                        clothes.Colors, clothes.SizeGroups);

            var result = await ValidateIncludes(clothesNotFound);

            Assert.True(result.HasErrors);
            Assert.True(result.Errors.First().ErrorResultType == ErrorResultType.ValueNotFound);
        }