Last active
March 11, 2018 18:05
-
-
Save Flayed/86a8e17a94e7832fef0ee7f416aaae15 to your computer and use it in GitHub Desktop.
MyServiceTests with Provide
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class MyServiceTests : TestBase | |
| { | |
| [Fact(DisplayName = "CalculateDistance should get the addresses from the address service")] | |
| public async Task CalculateDistance_LooksUpAddressesInAddressService() | |
| { | |
| double expected = 15623.32944; | |
| Mock.Mock<IAddressService>().SetupGet(x => x.GetAddress(It.IsAny<string>())).ReturnsAsync("123 Fake St, Duck, WV, 25063"); | |
| Provide<IDistanceCalculationService, DistanceCalculationService>(); | |
| var myService = Mock.Create<MyService>(); | |
| double distance = await myService.GetDistance("Duck"); | |
| distance.Should().Be(expected); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment