コード例 #1
0
        public void DeleteTopic_GivenValidTopicIdAndUser_ReturnOk()
        {
            var topicId  = 3;
            var user     = "******"UserId\" : \"ad\"}";
            var expected = new OkResult();
            var actual   = (StatusCodeResult)_topicController.DeleteTopic(topicId, user).Result;

            _topics.RemoveAll(t => t.Id == topicId);
            _posts.RemoveAll(p => p.TopicID == topicId);
            Assert.AreEqual(expected.StatusCode, actual.StatusCode);
        }
コード例 #2
0
        public async Task DeleteTopic_ServiceInvoke()
        {
            //Act
            await _topicController.DeleteTopic(It.IsAny <Guid>());

            //Assert
            _topicServiceMock.Verify(s => s.DeleteTopic(It.IsAny <Guid>()));
        }
コード例 #3
0
        public void TestDeleteTopic()
        {
            mockTopicService.Setup(x => x.Delete(It.IsAny <string>())).Returns(true);
            var           topicController = new TopicController(mockTopicService.Object);
            IActionResult isDelete        = topicController.DeleteTopic("asf5asfasfasfa3asdsd4");
            var           type            = isDelete.GetType();

            Assert.AreEqual(type.Name, "OkObjectResult");
        }
コード例 #4
0
        public void IsTopicDeleted()
        {
            validation.DeleteTopic(topicList[0].TopicID).Returns(topicListAdmin);
            topicController.Request       = new HttpRequestMessage();
            topicController.Configuration = new HttpConfiguration();


            var actionResult = topicController.DeleteTopic(topicList[0].TopicID);

            Assert.AreEqual(HttpStatusCode.OK, actionResult.StatusCode);
        }