public async void GetTaskProviderById_ReturnNull() { _taskProviderRepository .Setup(r => r.GetById(4, It.IsAny <CancellationToken>())) .ReturnsAsync((TaskProvider)null); var service = new TaskProviderService(_taskProviderRepository.Object, _externalServiceTypeRepository.Object, _tagRepository.Object); var result = await service.GetTaskProviderById(4); Assert.Null(result); }
public async void GetTaskProviderById_ReturnItem() { _taskProviderRepository .Setup(r => r.GetSingleBySpec(It.IsAny <TaskProviderFilterSpecification>(), It.IsAny <CancellationToken>())) .ReturnsAsync(new TaskProvider { Id = 1, Name = "GeneratorProvider1" }); var service = new TaskProviderService(_taskProviderRepository.Object, _externalServiceTypeRepository.Object, _tagRepository.Object); var result = await service.GetTaskProviderById(1); Assert.NotNull(result); Assert.Equal("GeneratorProvider1", result.Name); }