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

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

            var result = controller.GetKorTheoryItem(id);

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

            A.CallTo(() => context.GetKorTheoryItem(id)).Returns(korTheoryItem);
            var controller = new TheoryItemController(context);

            var result = controller.GetKorTheoryItem(id);

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