public void ShouldMappFromFrameworkFrameworkViewModelWhenFrameworkIsEmpty() { var service = new MappingService(Mock.Of <ILog>()); var framework = new GetFrameworkResponse { Framework = new Framework { Title = "title1", } }; var viewModel = service.Map <GetFrameworkResponse, FrameworkViewModel>(framework); viewModel.ExpiryDateString.Should().BeNull(); viewModel.Should().NotBeNull(); }
public void ShouldReturnFramework() { // Assign var response = new GetFrameworkResponse(); var viewModel = new FrameworkViewModel(); _mockMediator.Setup(m => m.Send(It.IsAny <GetFrameworkQuery>(), It.IsAny <CancellationToken>())) .ReturnsAsync(response); _mockMappingService.Setup(m => m.Map <GetFrameworkResponse, FrameworkViewModel>(response)) .Returns(viewModel); // Act var result = _sut.Framework("1", "test").Result as ViewResult; // Assert _mockMediator.Verify(m => m.Send(It.IsAny <GetFrameworkQuery>(), It.IsAny <CancellationToken>())); _mockMappingService.Verify(m => m.Map <GetFrameworkResponse, FrameworkViewModel>(response)); result.Model.Should().Be(viewModel); }
public void ShouldMappFromFrameworkFrameworkViewModel() { var service = new MappingService(Mock.Of <ILog>()); var framework = new GetFrameworkResponse { Framework = new Framework { Title = "Abba: Abba", ExpiryDate = new DateTime(1882, 09, 04), JobRoleItems = new List <JobRoleItem> { new JobRoleItem { Description = "Description 1", Title = "Title1" } } } }; var viewModel = service.Map <GetFrameworkResponse, FrameworkViewModel>(framework); viewModel.ExpiryDateString.Should().Be("5 September 1882"); viewModel.JobRoles.FirstOrDefault().Should().Be("Title1"); viewModel.Title.ShouldBeEquivalentTo("Abba"); }