コード例 #1
0
        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));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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));
        }