コード例 #1
0
        public ActionResult Index()
        {
            List <BagItem> allBagItem = BagItem.GetAll();

            return(View(allBagItem));
            // return new EmptyResult(); Fail CorrectView test
            //return View(0); Fail CorrectModelType Test
        }
コード例 #2
0
        public void GetAll_ReturnsEmptyList_BagItemList()
        {
            // Arrange
            List <BagItem> newBagItemList = new List <BagItem> {
            };

            // Act
            List <BagItem> result = BagItem.GetAll();

            // Assert
            CollectionAssert.AreEqual(newBagItemList, result);
        }
コード例 #3
0
        public void GetAll_ReturnsBagItems_BagItemList()
        {
            //Arrange
            string         nameOfItem01   = "Camera";
            string         nameOfItem02   = "Shoes";
            int            inputPrice01   = 500;
            int            inputPrice02   = 100;
            int            inputWeight01  = 9;
            int            inputWeight02  = 10;
            bool           packed01       = true;
            bool           packed02       = false;
            BagItem        newBagItem1    = new BagItem(nameOfItem01, inputPrice01, inputWeight01, packed01);
            BagItem        newBagItem2    = new BagItem(nameOfItem02, inputPrice02, inputWeight02, packed02);
            List <BagItem> newBagItemList = new List <BagItem> {
                newBagItem1, newBagItem2
            };

            //Act
            List <BagItem> resultBagItemList = BagItem.GetAll();

            //Assert
            CollectionAssert.AreEqual(newBagItemList, resultBagItemList);
        }