Exemplo n.º 1
0
        public async Task GetClothesDetails_Ok()
        {
            var    genderEntities                 = GenderEntitiesData.GenderEntities;
            var    clothesTypeEntities            = ClothesTypeEntitiesData.ClothesTypeEntities;
            var    genderType                     = genderEntities.First().GenderType;
            string clothesType                    = clothesTypeEntities.First().Name;
            var    clothesEntities                = ClothesEntitiesData.ClothesEntities;
            var    genderWithClothesEntities      = GenderEntitiesData.GetGenderEntitiesWithClothes(genderEntities, clothesEntities);
            var    clothesTypeWithClothesEntities = ClothesTypeEntitiesData.GetClothesTypeEntitiesWithClothes(clothesTypeEntities,
                                                                                                              clothesEntities);
            var genderTable            = GenderTableMock.GetGenderTable(genderWithClothesEntities);
            var clothesTypeTable       = ClothesTypeTableMock.GetClothesTypeTable(clothesTypeWithClothesEntities);
            var clothesTable           = ClothesTableMock.GetClothesTable(clothesEntities);
            var clothesEntityConverter = ClothesEntityConverterMock.ClothesDetailEntityConverter;
            var database = GetDatabase(genderTable, clothesTypeTable, clothesTable);
            var clothesDatabaseService = GetClothesDatabaseService(database.Object, GetDatabaseValidationService(clothesTable));

            var clothesResults = await clothesDatabaseService.GetClothesDetails(genderType, clothesType);

            var clothesDomains = clothesEntityConverter.FromEntities(clothesEntities);

            Assert.True(clothesResults.OkStatus);
            Assert.True(clothesResults.Value.SequenceEqual(clothesDomains.Value.Where(clothes => clothes.GenderType == genderType &&
                                                                                      clothes.ClothesTypeName == clothesType)));
        }
Exemplo n.º 2
0
        public async Task GetClothes_Error()
        {
            var    errorInitial                   = ErrorData.DatabaseError;
            var    genderEntities                 = GenderEntitiesData.GenderEntities;
            var    clothesTypeEntities            = ClothesTypeEntitiesData.ClothesTypeEntities;
            var    genderType                     = genderEntities.First().GenderType;
            string clothesType                    = clothesTypeEntities.First().Name;
            var    clothesEntities                = ClothesEntitiesData.ClothesEntities;
            var    clothesResult                  = new ResultCollection <ClothesEntity>(errorInitial);
            var    genderWithClothesEntities      = GenderEntitiesData.GetGenderEntitiesWithClothes(genderEntities, clothesEntities);
            var    clothesTypeWithClothesEntities = ClothesTypeEntitiesData.GetClothesTypeEntitiesWithClothes(clothesTypeEntities,
                                                                                                              clothesEntities);
            var genderTable            = GenderTableMock.GetGenderTable(genderWithClothesEntities);
            var clothesTypeTable       = ClothesTypeTableMock.GetClothesTypeTable(clothesTypeWithClothesEntities);
            var clothesTable           = ClothesTableMock.GetClothesTable(clothesResult);
            var database               = GetDatabase(genderTable, clothesTypeTable, clothesTable.Object);
            var clothesDatabaseService = GetClothesDatabaseService(database.Object, GetDatabaseValidationService(clothesTable.Object));

            var clothesResults = await clothesDatabaseService.GetClothes(genderType, clothesType);

            Assert.True(clothesResults.HasErrors);
            Assert.Equal(errorInitial.ErrorResultType, clothesResults.Errors.First().ErrorResultType);
        }