Ejemplo n.º 1
0
        public TopicsControllerTest()
        {
            DbTopics topics = new DbTopics();
            var      config = new MapperConfiguration(cfg =>
            {
                cfg.AddProfile <AutoMapperMapings>();
                cfg.CreateMap <Topic, TopicAPI>();
            });
            var mapper = config.CreateMapper();

            topicsController = new TopicsController(topics, mapper);
        }
Ejemplo n.º 2
0
        public void TestPostTopic()
        {
            ExpectedCourses expectedCourses = new ExpectedCourses();
            string          courseName      = expectedCourses.GetCourses()[0].title;
            DbTopics        dbTopics        = new DbTopics();
            string          topicName       = "Test Topic";
            ObjectResult    result          = (ObjectResult)topicsController.Post(courseName, topicName);
            int?            statusCode      = result.StatusCode;

            Assert.Equal(201, statusCode);
            Assert.True(dbTopics.IsExistTopic(courseName, topicName));
            topicsController.Delete(courseName, topicName);
        }