コード例 #1
0
    public async Task TopicController_IndexAsync_ReturnsTopicViewResult() {

      var controller            = new TopicController(_topicRepository, _topicMappingService) {
        ControllerContext       = _context
      };

      var result                = await controller.IndexAsync(_topic.GetWebPath()).ConfigureAwait(false) as TopicViewResult;
      var model                 = result.Model as PageTopicViewModel;

      controller.Dispose();

      Assert.IsNotNull(model);
      Assert.AreEqual<string>("Web_0_1_1", model.Title);

    }
コード例 #2
0
    public async Task TopicController_IndexAsync() {

      var topicRoutingService   = new MvcTopicRoutingService(_topicRepository, _uri, _routeData);
      var mappingService        = new TopicMappingService(_topicRepository, new TopicViewModelLookupService());

      var controller            = new TopicController(_topicRepository, topicRoutingService, mappingService);
      var result                = await controller.IndexAsync(_topic.GetWebPath()).ConfigureAwait(false) as TopicViewResult;
      var model                 = result.Model as PageTopicViewModel;

      controller.Dispose();

      Assert.IsNotNull(model);
      Assert.AreEqual<string>("Web_0_1_1", model.Title);

    }