public void PutBookTest(PutTestValue testValue)
        {
            var controller = new BookController(this.GetContextWithData());

            controller.Put(testValue.Id, testValue.Body.ToString());
            var expectedBook = new Book(testValue.Id, (string)testValue.Body["Title"], (string)testValue.Body["Author"], (string)testValue.Body["Publisher"]);
            var getResponse  = controller.Get(testValue.Id);

            Assert.That(JsonConvert.SerializeObject(expectedBook), Is.EqualTo(getResponse));
        }
        public void PutStoreTest(PutTestValue testValue)
        {
            var controller = new StoreController(this.GetContextWithData());

            controller.Put(testValue.Id, testValue.Body.ToString());
            var expectedStore  = new Store(testValue.Id, testValue.Body["Body"].ToObject <List <Book> >());
            var retrievedStore = controller.Get(testValue.Id);

            Assert.That(JsonConvert.SerializeObject(expectedStore), Is.EqualTo(retrievedStore));
        }
Exemple #3
0
        public void PutOrderTest(PutTestValue testValue)
        {
            var controller = new OrderController(this.GetContextWithData());

            controller.Put(testValue.Id, testValue.Body.ToString());
            var expectedOrder  = new Order(testValue.Id, testValue.Body["Body"].ToObject <List <Book> >(), (string)testValue.Body["Destination"]);
            var retrievedOrder = controller.Get(testValue.Id);

            Assert.That(JsonConvert.SerializeObject(expectedOrder), Is.EqualTo(retrievedOrder));
        }