public void GetProductsThrowsWithWrongArgument() { // arrange var model = _requestModelFactory.CreateRequest(); var jsonDocument = SerializeAndCreateJsonDocmuent(model); var builder = new RequestFromJsonBuilder(null); // act var jsonElement = jsonDocument.RootElement.GetProperty("Contract"); Action act = () => builder.GetProducts(jsonElement); // assert act.Should().Throw <ArgumentException>(); }
public void CanRetrieve_Products_FromDocument() { // arrange var model = _requestModelFactory.CreateRequest(); var jsonDocument = SerializeAndCreateJsonDocmuent(model); var builder = new RequestFromJsonBuilder(null); // act var jsonElement = jsonDocument.RootElement.GetProperty("Contract").GetProperty("Products"); IList <Product> products = builder.GetProducts(jsonElement); // assert products.Count.Should().BeGreaterThan(0); products[0].ID.Should().NotBe(0); products[0].Name.Should().NotBeNullOrEmpty(); products[0].Description.Should().NotBeNullOrEmpty(); }