public void WhenSearching_ThenOk() { // Arrange using (SimpleServer.Create(TestHelpers.BaseUrl, EventHandler)) { var client = new YouScribeClient(TestHelpers.BaseUrl); var request = client.CreateProductSearchRequest(); // Act var results = request.SearchProductsAsync( new ProductSearchInputModel() { id = new List<int>() { 5, 9, 18 }, domain_language = "fr", quicksearch = "pouet$&" }).Result; // Assert Assert.Empty(request.Error.Messages); Assert.NotNull(results); Assert.Equal(1, results.TotalResults); Assert.NotEmpty(results.Products); Assert.Equal("bouh", results.Products.First().Title); Assert.Equal(2, results.Products.First().ExtractPublicFormatExtensions.Count()); Assert.Equal(2, results.Products.First().PublicFormatExtensions.Count()); var theme = results.Products.First().Theme; Assert.NotNull(theme); Assert.Equal(138, theme.Id); Assert.Equal("{\"id\":[5,9,18],\"theme_id\":null,\"category_id\":null,\"quicksearch\":\"pouet$&\",\"author\":null,\"offer_type\":[],\"title\":null,\"domain_language\":\"fr\",\"is_adult_content\":null,\"skip\":0,\"take\":10,\"sort\":[],\"language_id\":null,\"price_group\":null,\"access_type\":null,\"excluded_theme_id\":[]}", postData); } }
public void WhenSearching_ThenOk() { // Arrange using (SimpleServer.Create(TestHelpers.BaseUrl, EventHandler)) { var client = new YouScribeClient(TestHelpers.BaseUrl); var request = client.CreateProductSearchRequest(); // Act var results = request.SearchProductsAsync( new ProductSearchInputModel() { id = new List <int>() { 5, 9, 18 }, domain_language = "fr", quicksearch = "pouet$&", sensibility_id = new List <int>() { 1, 2, 3 } }).Result; // Assert Assert.Empty(request.Error.Messages); Assert.NotNull(results); Assert.Equal(1, results.TotalResults); Assert.NotEmpty(results.Products); Assert.Equal("bouh", results.Products.First().Title); Assert.Equal(2, results.Products.First().ExtractPublicFormatExtensions.Count()); Assert.Equal(2, results.Products.First().PublicFormatExtensions.Count()); var theme = results.Products.First().Theme; Assert.NotNull(theme); Assert.Equal(138, theme.Id); } }