コード例 #1
0
        public async Task FilterProducts_SendViableValues_ReturnView()
        {
            // Arrange
            SellListingsController controller = new SellListingsController(context);

            // Act
            var actionResult = await controller.FilterProducts("Hello", 3, 200);

            // Assert
            Assert.IsType <ViewResult>(actionResult);
        }
コード例 #2
0
        public async Task FilterMerchandise_SendNullData_ReturnView()
        {
            // Arrange
            SellListingsController controller = new SellListingsController(context);

            // Act
            var actionResult = await controller.FilterMerchandise(null, 0, 0);

            // Assert
            Assert.IsType <ViewResult>(actionResult);
        }
コード例 #3
0
        public void Details_PassInNull_ReturnNotFound()
        {
            // Arrange
            SellListingsController controller = new SellListingsController(context);

            // Act
            var actionResult = controller.Details(null);

            // Assert
            Assert.IsType <NotFoundResult>(actionResult.Result);
        }
コード例 #4
0
        public void ChooseIndex_PassIn2_ReturnRedirection()
        {
            // Arrange
            SellListingsController controller = new SellListingsController(context);

            // Act
            var actionResult = controller.ChooseIndex(2);

            // Assert
            Assert.IsType <RedirectToActionResult>(actionResult.Result);
        }
コード例 #5
0
        public async void MerchandiseIndex_CallFunction_ReturnView()
        {
            // Arrange
            SellListingsController controller = new SellListingsController(context);

            // Act
            var actionResult = await controller.MerchandiseIndex();

            // Assert
            Assert.IsType <ViewResult>(actionResult);
        }
コード例 #6
0
        public void PopulateDropdown_SendYes_ReturnListOfSelectListItems()
        {
            // Arrange
            SellListingsController controller = new SellListingsController(context);

            // Act
            var list = controller.PopulateDropdown("Yes");

            // Assert
            Assert.True(list.Count > 0);
        }
コード例 #7
0
        public void SetViewBag_PassInHelloAndNothing_ReturnCollapseAndHelloInViewBags()
        {
            // Arrange
            SellListingsController controller = new SellListingsController(context);

            // Act
            controller.SetViewBag("Hello", 0, 0, "");

            // Assert
            Assert.Equal("collapse", controller.ViewBag.Collapse);
            Assert.Equal("Hello", controller.ViewBag.Search);
        }