public async Task Test2() { var iata = this.fixture.Create <string>(); var repository = new PointLocationRepository(this.cacheMock.Object); this.SetupCacheGetAsyncMethod(null !); var location = await repository.GetAsync(iata, CancellationToken.None); location.Should().BeOfType <Maybe <Location> >(); location.Should().Be(Maybe <Location> .None); }
public async Task Test1() { var iata = this.fixture.Create <string>(); var expectedValue = this.fixture.Create <Location>(); var expectedValueEncoded = Encoding.UTF8.GetBytes(JsonSerializer.Serialize(expectedValue)); var repository = new PointLocationRepository(this.cacheMock.Object); this.SetupCacheGetAsyncMethod(expectedValueEncoded); var location = await repository.GetAsync(iata, CancellationToken.None); location.Value.Should().BeEquivalentTo(expectedValue); }
public async Task Test3() { var iata = this.fixture.Create <string>(); var repository = new PointLocationRepository(this.cacheMock.Object); this.SetupCacheSaveAsyncMethod(); await repository.SetAsync(iata, this.fixture.Create <Location>(), CancellationToken.None); this.cacheMock .Verify(x => x.SetAsync( iata, It.IsAny <byte[]>(), It.IsAny <DistributedCacheEntryOptions>(), It.IsAny <CancellationToken>()), Times.Once); }