示例#1
0
        public void GetEngTheoryItem404Test()
        {
            int id      = 123;
            var context = A.Fake <ITKDTheoryAppContext>();

            A.CallTo(() => context.GetEngTheoryItem(id)).Returns(null);
            var controller = new TheoryItemController(context);

            var result = controller.GetEngTheoryItem(id);

            Assert.IsInstanceOf <NotFoundResult>(result.Result);
        }
示例#2
0
        public void GetEngTheoryItem200Test()
        {
            int id            = 123;
            var context       = A.Fake <ITKDTheoryAppContext>();
            var seedData      = new SeedData();
            var engTheoryItem = seedData.GetEngTheoryItem(id);

            A.CallTo(() => context.GetEngTheoryItem(id)).Returns(engTheoryItem);
            var controller = new TheoryItemController(context);

            var result = controller.GetEngTheoryItem(id);

            Assert.AreEqual(engTheoryItem, result.Value);
        }