public async Task GetStandard_Returns_Valid_Standard() { var standardCode = "547"; var standardName = "Broadcast and Media Systems Technician"; var standardSectorCode = "11"; var apiStandard = new Models.StandardModel { StandardCode = standardCode, StandardName = standardName, StandardSectorCode = standardSectorCode }; _azureServiceMock .Setup(m => m.GetStandard(standardCode)) .ReturnsAsync(apiStandard); var service = new StandardService(_azureServiceMock.Object, _searchCleaningServiceMock.Object); var result = await service.GetStandard(standardCode); _azureServiceMock.Verify(m => m.GetStandard(standardCode), Times.Once); result.StandardCode.Should().Be(standardCode); result.StandardName.Should().Be(standardName); result.StandardSectorCode.Should().Be(standardSectorCode); }
public async Task GetStandard_Returns_Valid_Standard() { var standardCode = "547"; var standardName = "Broadcast and Media Systems Technician"; var StandardSectorCode = "11"; var azureStandard = new StandardModel { StandardCode = standardCode, StandardName = standardName, StandardSectorCode = StandardSectorCode }; var apiStandard = new Models.StandardModel { StandardCode = standardCode, StandardName = standardName, StandardSectorCode = StandardSectorCode }; var mapperMock = new Mock <IMapper <StandardModel, Models.StandardModel> >(); mapperMock.Setup(m => m.Map(azureStandard)).Returns(apiStandard); var indexServiceMock = new Mock <IStandardIndexService>(); var azureServiceMock = new Mock <IAzureService>(); azureServiceMock .Setup(m => m.GetAsync <StandardModel>(It.IsAny <IStandardIndexService>(), standardCode)) .ReturnsAsync(azureStandard); var queryServiceMock = new Mock <IODataQueryService>(); var searchTermFormattingServiceMock = new Mock <ISearchTermFormattingService>(); var service = new AzureStandardService( indexServiceMock.Object, mapperMock.Object, azureServiceMock.Object, queryServiceMock.Object, searchTermFormattingServiceMock.Object); var result = await service.GetStandard(standardCode); azureServiceMock.Verify(m => m.GetAsync <StandardModel>(It.IsAny <IStandardIndexService>(), standardCode), Times.Once); result.Should().BeSameAs(apiStandard); }