public void PostBookTest(PostTestValue testValue) { var controller = new BookController(this.GetContextWithData()); var postResponse = controller.Post(testValue.Body.ToString()); var expectedBook = new Book(postResponse, (string)testValue.Body["Title"], (string)testValue.Body["Author"], (string)testValue.Body["Publisher"]); var getResponse = controller.Get(postResponse); Assert.That(JsonConvert.SerializeObject(expectedBook), Is.EqualTo(getResponse)); }
public void PostStoreTest(PostTestValue testValue) { var controller = new StoreController(this.GetContextWithData()); var storeId = controller.Post(testValue.Body.ToString()); var expectedStore = new Store(storeId, testValue.Body["Body"].ToObject <List <Book> >()); var retrievedStore = controller.Get(storeId); Assert.That(JsonConvert.SerializeObject(expectedStore), Is.EqualTo(retrievedStore)); }
public void PostOrderTest(PostTestValue testValue) { var controller = new OrderController(this.GetContextWithData()); var orderId = controller.Post(testValue.Body.ToString()); var expectedOrder = new Order(orderId, testValue.Body["Body"].ToObject <List <Book> >(), (string)testValue.Body["Destination"]); var retrievedOrder = controller.Get(orderId); Assert.That(JsonConvert.SerializeObject(expectedOrder), Is.EqualTo(retrievedOrder)); }