public async Task SharedContentCacheReloadServiceReloadAllCancellationRequestedCancels() { //Arrange var cancellationToken = new CancellationToken(true); var sharedContentCacheReloadService = new SharedContentCacheReloadService(A.Fake <ILogger <SharedContentCacheReloadService> >(), fakeMapper, fakeSharedContentItemDocumentService, fakeCmsApiService); //Act await sharedContentCacheReloadService.Reload(cancellationToken).ConfigureAwait(false); //Assert A.CallTo(() => fakeCmsApiService.GetItemAsync <SharedContentItemApiDataModel>(A <string> .Ignored, A <Guid> .Ignored)).MustNotHaveHappened(); A.CallTo(() => fakeSharedContentItemDocumentService.UpsertAsync(A <SharedContentItemModel> .Ignored)).MustNotHaveHappened(); }
public async Task SharedContentCacheReloadServiceReloadSharedContentNullApiResponse() { //Arrange SharedContentItemApiDataModel?nullContentItem = null; A.CallTo(() => fakeCmsApiService.GetItemAsync <SharedContentItemApiDataModel>(A <string> .Ignored, A <Guid> .Ignored)).Returns(nullContentItem); var sharedContentCacheReloadService = new SharedContentCacheReloadService(A.Fake <ILogger <SharedContentCacheReloadService> >(), fakeMapper, fakeSharedContentItemDocumentService, fakeCmsApiService); //Act await sharedContentCacheReloadService.ReloadSharedContent(CancellationToken.None).ConfigureAwait(false); //Assert A.CallTo(() => fakeCmsApiService.GetItemAsync <SharedContentItemApiDataModel>(A <string> .Ignored, A <Guid> .Ignored)).MustHaveHappened(SharedContentKeyHelper.GetSharedContentKeys().Count(), Times.Exactly); A.CallTo(() => fakeSharedContentItemDocumentService.UpsertAsync(A <SharedContentItemModel> .Ignored)).MustNotHaveHappened(); }