public void Initialize() { _logger = A.Fake <ILogger <DistanceMeasurementService> >(); _mediator = A.Fake <IMediator>(); _measureSensor = A.Fake <IMeasureSensor>(); _sut = new DistanceMeasurementService(_logger, _mediator, _measureSensor); _measureInterval = TimeSpan.FromSeconds(1); _defaultCancellationToken = CancellationToken.None; }
public async Task Test1() { var couple = new OriginDestination(AmsIata, BudIata); var service = new DistanceMeasurementService(this.placeInfoProviderMock.Object); this.SetupPlaceInfoProviderGetPlaceInfoAsyncMethod(AmsIata, new IataPoint(AmsIata, new Location(AmsLatitude, AmsLongitude))); this.SetupPlaceInfoProviderGetPlaceInfoAsyncMethod(BudIata, new IataPoint(BudIata, new Location(BudLatitude, BudLongitude))); var serviceResponse = await service.GetDistanceAsync(couple, CancellationToken.None); serviceResponse.IsFailure.Should().BeFalse(); serviceResponse.Value.Should().Be(AsmBudDistance); }
public async Task Test2() { var incorrectIata = this.fixture.Create <string>(); var couple = new OriginDestination(AmsIata, incorrectIata); var service = new DistanceMeasurementService(this.placeInfoProviderMock.Object); this.SetupPlaceInfoProviderGetPlaceInfoAsyncMethod(AmsIata, new IataPoint(AmsIata, new Location(AmsLatitude, AmsLongitude))); this.SetupPlaceInfoProviderGetPlaceInfoAsyncMethod(incorrectIata, Result.Failure <IataPoint>(this.fixture.Create <string>())); var serviceResponse = await service.GetDistanceAsync(couple, CancellationToken.None); serviceResponse.IsFailure.Should().BeTrue(); }