Exemplo n.º 1
0
        public async Task Post_Recipe_ExpectRecipe()
        {
            var getallResponse = await _http.GetAsync("api/recipe");

            getallResponse.EnsureSuccessStatusCode();
            var recipes = await getallResponse.GetObject <Recipe[]>();

            var newRecipe = new RecipeFixture("new recipe")
                            .WithIngredient(new Ingredient {
                Weight = 1d, TypeID = recipes.First().Ingredients.First().TypeID
            })
                            .WithStep(new Step {
                Text = "Cook me", CookTime = "00:10:00", PrepTime = "00:20:00"
            }).Build();

            newRecipe.Ingredients.First().TypeID = recipes.First().Ingredients.First().TypeID;
            var response = await _http.PostAsync("api/recipe", newRecipe.GetStringContent());

            response.EnsureSuccessStatusCode();
            var updatedRecipe = await response.GetObject <Recipe>();

            dataSamples.AddRecipeToStorage(updatedRecipe.ConvertToEntity());

            var updatedRecipesResponse = await _http.GetAsync("api/recipe");

            updatedRecipesResponse.EnsureSuccessStatusCode();

            var updatedRecipes = await updatedRecipesResponse.GetObject <Recipe[]>();

            Assert.False(updatedRecipe == null, "Recipe should not be null");
            Assert.True(updatedRecipe.Name == newRecipe.Name, "Names should be the same");
            Assert.True(recipes.Length + 1 == updatedRecipes.Length, "There should be one new recipe");
        }
Exemplo n.º 2
0
 public CraftingDisciplineTest(RecipeFixture fixture)
 {
     _fixture = fixture;
 }
Exemplo n.º 3
0
 public RecipeDiscriminatorOptionsTest(RecipeFixture fixture)
 {
     _fixture = fixture;
 }
Exemplo n.º 4
0
 public RecipeFlagTest(RecipeFixture fixture)
 {
     _fixture = fixture;
 }
Exemplo n.º 5
0
 public RecipeTest(RecipeFixture fixture, ITestOutputHelper output)
 {
     _fixture = fixture;
     _output  = output;
 }