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 SharedContentCacheReloadServiceReloadAllReloadsItems() { //Arrange var dummyContentItem = A.Dummy <SharedContentItemApiDataModel>(); A.CallTo(() => fakeCmsApiService.GetItemAsync <SharedContentItemApiDataModel>(A <string> .Ignored, A <Guid> .Ignored)).Returns(dummyContentItem); var sharedContentCacheReloadService = new SharedContentCacheReloadService(A.Fake <ILogger <SharedContentCacheReloadService> >(), fakeMapper, fakeSharedContentItemDocumentService, fakeCmsApiService); //Act await sharedContentCacheReloadService.Reload(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)).MustHaveHappened(SharedContentKeyHelper.GetSharedContentKeys().Count(), Times.Exactly); }