Пример #1
0
        public void TestSaveNew()
        {
            var menuDao = A.Fake<IMenuDao>();
            var menuService = new MenuService(menuDao);

            var user = new User()
            {
                ContactNo = "123456",
                Email = "*****@*****.**",
                FullName = "Jayson Valeroso",
                Username = "******"
            };

            var newMenu = new Menu()
            {
                Date = DateTime.Now
            };

            A.CallTo(() => menuDao.Save(newMenu)).Returns(newMenu);

            var savedMenu = menuService.SaveNew(newMenu, user);

            Assert.AreEqual(MenuStatus.Draft, savedMenu.MenuStatus);
            Assert.AreEqual("jvalero", savedMenu.Vendor.Username);
        }
Пример #2
0
        public void TestPublishMenu()
        {
            var menuDao = A.Fake<IMenuDao>();
            var menuService = new MenuService(menuDao);

            var menu = new Menu()
            {
                Date = DateTime.Now
            };

            A.CallTo(() => menuDao.Save(menu)).Returns(menu);

            menuService.Publish(menu);

            Assert.AreEqual(MenuStatus.Published, menu.MenuStatus);
        }