Ejemplo n.º 1
0
        public void Controller_Shop_BusinessReport_Invalid_ID_Should_Fail()
        {
            // Arrange
            ShopController controller = new ShopController();
            string         id         = "bogus";

            // Act
            var result = (RedirectToRouteResult)controller.BusinessReport(id);

            // Assert
            Assert.AreEqual("Error", result.RouteValues["action"], TestContext.TestName);
        }
Ejemplo n.º 2
0
        public void Controller_Shop_BusinessReport_Valid_Id_Should_Pass()
        {
            // Arrange
            ShopController controller = new ShopController();
            var            data       = Backend.DataSourceBackend.Instance.StudentBackend.GetDefault();

            data.Id = DataSourceBackend.Instance.StudentBackend.GetDefault().Id;

            // Act
            var myStudent          = DataSourceBackend.Instance.StudentBackend.Read(data.Id);
            var expectIncome       = myStudent.Truck.Income;
            var expectOutcome      = myStudent.Truck.Outcome;
            var expectBusinessList = myStudent.Truck.BusinessList;

            var result     = controller.BusinessReport(data.Id) as ViewResult;
            var myStudent2 = DataSourceBackend.Instance.StudentBackend.Read(data.Id);

            //// Assert
            Assert.AreEqual(expectIncome, myStudent2.Truck.Income, TestContext.TestName);
            Assert.AreEqual(expectOutcome, myStudent2.Truck.Outcome, TestContext.TestName);
            Assert.AreEqual(expectBusinessList, myStudent2.Truck.BusinessList, TestContext.TestName);
        }