public async Task Get_WhenValueDoesNotExists_ShouldReturnCorrectValue( MemoryCacheEntryRepository sut, string cacheKey, Dictionary<string, string> attributes) { //arrange //act var actual = await sut.Get<object>(CancellationToken.None, cacheKey, attributes); //assert actual.Should().BeNull(); }
public async Task Get_WhenValueDoesNotExists_ShouldReturnCorrectValue( MemoryCacheEntryRepository sut, string cacheKey, Dictionary <string, string> attributes) { //arrange //act var actual = await sut.Get <object>(CancellationToken.None, cacheKey, attributes); //assert actual.Should().BeNull(); }
public async Task Get_WhenValueIsUpdated_ShouldReturnCorrectValue( MemoryCacheEntryRepository sut, CacheEntry<object> cacheEntry, object newValue) { //arrange var expected = new CacheEntry<object>(cacheEntry.Id, cacheEntry.CacheKey, cacheEntry.Attributes, DateTimeOffset.Now, newValue); await sut.AddOrUpdate(CancellationToken.None, cacheEntry); await sut.AddOrUpdate(CancellationToken.None, expected); //act var actual = await sut.Get<object>(CancellationToken.None, expected.CacheKey, expected.Attributes); //assert actual.Should().Be(expected); }
public async Task Get_WhenValueExists_ShouldReturnCorrectValue( MemoryCacheEntryRepository sut, [Frozen]Dictionary<string, string> attributes, [Frozen]string cacheKey, [Frozen]Guid id, CacheEntry<object> expected) { //arrange await sut.AddOrUpdate(CancellationToken.None, expected); //act var actual = await sut.Get<object>(CancellationToken.None, expected.CacheKey, expected.Attributes); //assert actual.Should().Be(expected); }
public async Task Get_AfterRemoving_ShouldReturnCorrectValue( MemoryCacheEntryRepository sut, CacheEntry <object> cacheEntry, object newValue) { //arrange await sut.AddOrUpdate(CancellationToken.None, cacheEntry); await sut.Remove <CacheEntry <object> >(CancellationToken.None, cacheEntry.CacheKey, cacheEntry.Id); //act var actual = await sut.Get <object>(CancellationToken.None, cacheEntry.CacheKey, cacheEntry.Attributes); //assert actual.Should().BeNull(); }
public async Task Get_WhenValueExists_ShouldReturnCorrectValue( MemoryCacheEntryRepository sut, [Frozen] Dictionary <string, string> attributes, [Frozen] string cacheKey, [Frozen] Guid id, CacheEntry <object> expected) { //arrange await sut.AddOrUpdate(CancellationToken.None, expected); //act var actual = await sut.Get <object>(CancellationToken.None, expected.CacheKey, expected.Attributes); //assert actual.Should().Be(expected); }
public async Task Get_WhenValueIsUpdated_ShouldReturnCorrectValue( MemoryCacheEntryRepository sut, CacheEntry <object> cacheEntry, object newValue) { //arrange var expected = new CacheEntry <object>(cacheEntry.Id, cacheEntry.CacheKey, cacheEntry.Attributes, DateTimeOffset.Now, newValue); await sut.AddOrUpdate(CancellationToken.None, cacheEntry); await sut.AddOrUpdate(CancellationToken.None, expected); //act var actual = await sut.Get <object>(CancellationToken.None, expected.CacheKey, expected.Attributes); //assert actual.Should().Be(expected); }
public async Task Get_AfterRemoving_ShouldReturnCorrectValue( MemoryCacheEntryRepository sut, CacheEntry<object> cacheEntry, object newValue) { //arrange await sut.AddOrUpdate(CancellationToken.None, cacheEntry); await sut.Remove<CacheEntry<object>>(CancellationToken.None, cacheEntry.CacheKey, cacheEntry.Id); //act var actual = await sut.Get<object>(CancellationToken.None, cacheEntry.CacheKey, cacheEntry.Attributes); //assert actual.Should().BeNull(); }