public async Task MeasurementService_GetDeviceDataAsync_Tests() { //Valid Tests repoMock.Setup(t => t.GetContentAsync(It.IsAny <string>())).ReturnsAsync("2018-11-29T07:54:55,,03"); var result = await service.GetDeviceDataAsync("deviceId", DateTime.Now); Assert.IsType <List <SensorData> >(result); //Invalid Tests repoMock.Setup(t => t.GetContentAsync(It.IsAny <string>())).ThrowsAsync(new Exception()); result = await service.GetDeviceDataAsync("deviceId", DateTime.Now); Assert.Null(result); }