public void Gender_Equal_Gender() { var first = GenderData.GenderDomains.First(); var second = new GenderDomain(first.GenderType, first.Name); Assert.True(first.Equals(second)); }
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()); }
public void ValidateModel_NameError() { var genderEmptyName = new GenderDomain(GenderType.Female, String.Empty); var result = ValidateModel(genderEmptyName); Assert.True(result.HasErrors); Assert.True(result.Errors.First().ErrorResultType == ErrorResultType.ValueNotValid); }
public void Gender_Equal_Ok() { const GenderType genderType = GenderType.Male; const string genderName = "Мужик"; var genderDomain = new GenderDomain(genderType, genderName); int genderHash = HashCode.Combine(genderType); Assert.Equal(genderHash, genderDomain.GetHashCode()); }
public async Task ValidateIncludes_GenderNotFound() { var gender = new GenderDomain(GenderType.Child, "NotFound"); var clothes = ClothesData.ClothesMainDomains.First(); var clothesNotFound = new ClothesMainDomain(clothes, clothes.Images, gender, clothes.ClothesType, clothes.Colors, clothes.SizeGroups); var result = await ValidateIncludes(clothesNotFound); Assert.True(result.HasErrors); Assert.True(result.Errors.First().ErrorResultType == ErrorResultType.ValueNotFound); }
private void FillViewBag() { ViewBag.Genders = GenderDomain.ListGenders().Select(g => new SelectListItem() { Text = g.Name, Value = g.Id.ToString() }); ViewBag.Cities = CityDomain.ListCities().Select(g => new SelectListItem() { Text = g.Name, Value = g.Id.ToString() }); ViewBag.Regions = RegionDomain.ListRegions().Select(g => new SelectListItem() { Text = g.Name, Value = g.Id.ToString() }); ViewBag.Classifications = ClassificationDomain.ListClassifications().Select(g => new SelectListItem() { Text = g.Name, Value = g.Id.ToString() }); ViewBag.Sellers = UserDomain.ListUsers().Select(g => new SelectListItem() { Text = g.Login, Value = g.Id.ToString() }); }