Exemple #1
0
        public void WhenNothingHasHappenedTotalAndGoalAreZero()
        {
            var proteinTrackingService = Mock.Create<IProteinTrackingService>();

            ProteinTrackerController controller = new ProteinTrackerController(proteinTrackingService);

            ViewResult result = controller.Index() as ViewResult;

            Assert.AreEqual(0, result?.ViewBag.Total);
            Assert.AreEqual(0, result?.ViewBag.Goal);
        }
Exemple #2
0
        public void WhenTotalIsNotZero_and_AddProtein()
        {
            var proteinTrackingService = Mock.Create<IProteinTrackingService>();

            proteinTrackingService.Total = 10;


            ProteinTrackerController controller = new ProteinTrackerController(proteinTrackingService);

            ViewResult result = controller.AddProtein(15) as ViewResult;

            Assert.AreEqual(25, result?.ViewBag.Total);
            Assert.AreEqual(0, result?.ViewBag.Goal);
        }