Example #1
0
        public void GetItemt_WillGetNotFoundItem()
        {
            var controller = new ItemController(GetTestItems());

            var result = controller.GetItem(999);
            Assert.IsInstanceOfType(result, typeof(NotFoundResult));
        }
Example #2
0
        public async Task GetEveryItemsAsync_WillReturnEveryItems()
        {
            var testItems = GetTestItems();
            var controller = new ItemController(testItems);

            var result = await controller.GetEveryItemsAsync() as List<Item>;
            Assert.AreEqual(testItems.Count, result.Count);
        }
Example #3
0
        public void GetEveryItems_WillReturnEveryItems()
        {
            var testItems = GetTestItems();
            var controller = new ItemController(testItems);

            var result = controller.GetEveryItems() as List<Item>;
            Assert.AreEqual(testItems.Count, result.Count);
        }
Example #4
0
        public async Task GetItemAsync_WillReturnRightItem()
        {
            var testItems = GetTestItems();
            var controller = new ItemController(testItems);

            var result = await controller.GetItemAsync(3) as OkNegotiatedContentResult<Item>;
            Assert.IsNotNull(result);
            Assert.AreEqual(testItems[2].Name, result.Content.Name);
        }
Example #5
0
        public void GetItem_WillReturnRightItem()
        {
            var testItems = GetTestItems();
            var controller = new ItemController(testItems);

            var result = controller.GetItem(4) as OkNegotiatedContentResult<Item>;
            Assert.IsNotNull(result);
            Assert.AreEqual(testItems[3].Name, result.Content.Name);
        }