/MusicStore.AcceptanceTest/1.4ProductSpec.cs
C# | 41 lines | 36 code | 5 blank | 0 comment | 0 complexity | 7f17a743e3fd7a897d4cbdcd01121399 MD5 | raw file
- using FluentAssertions;
- using MusicStore.Api.Models;
- using Newtonsoft.Json.Linq;
- using NSpec;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using System.Net.Http;
- namespace MusicStore.AcceptanceTest
- {
- public class ProductsSpec : nspec
- {
- public void Given_the_List_of_Products_added_to_the_Database()
- {
- it["Should be able to get upto first 10 products without sending page number"] = () =>
- {
-
- var client = HttpClientFactory.CreateClient();
- HttpResponseMessage message = client.GetAsync("/api/products/GetAll/1").Result;
- JObject items = JObject.Parse(message.Content.ReadAsStringAsync().Result);
- ListOfProducts productViewModels = items.ToObject<ListOfProducts>();
- productViewModels.Products.Select(p => p.Id).Should().ContainInOrder(Enumerable.Range(1, 10));
- };
- it["Should be able to get 10 products based on the page Number"] = () =>
- {
-
- var client = HttpClientFactory.CreateClient();
- HttpResponseMessage message = client.GetAsync("/api/products/GetAll/2").Result;
- JObject items = JObject.Parse(message.Content.ReadAsStringAsync().Result);
- ListOfProducts productViewModels = items.ToObject<ListOfProducts>();
- productViewModels.Products.Select(p => p.Id).Should().ContainInOrder(Enumerable.Range(11, 7));
- };
- xit["Should be able to get the details about the product by selecting the product"] = () =>
- {
- };
- }
- }
- }