public void SaveKeysCollectionSuccessTest() { #region Test Setup var options = new MemoryCacheOptions(); var cache = new MemoryCache(options); #endregion var mockDefinition = mockDefinitionFake.Generate(); var saveMockDefinitionCommand = new SaveMockDefinitionCommand(mockDefinition, ref TestUtils.databaseLock); var Target = new SaveMockDefinitionHandler(cache, data); Target.Handle(saveMockDefinitionCommand, CancellationToken.None).Result.ToString(); cache.TryGetValue(data.mockIds, out List <string> Actual); Assert.Contains(mockDefinition.Metadata.Title, Actual); }
public void SaveMockDefinitionCacheFailedNullTitleTest() { #region Test Setup var options = new MemoryCacheOptions(); var cache = new MemoryCache(options); var mockDefinition = mockDefinitionFake.Generate(); mockDefinition.Metadata.Title = null; var input = new { mockDefinition }; #endregion var saveMockDefinitionCommand = new SaveMockDefinitionCommand(input.mockDefinition, ref TestUtils.databaseLock); var Target = new SaveMockDefinitionHandler(cache, data); Assert.Throws <ArgumentNullException>(() => Target.Handle(saveMockDefinitionCommand, CancellationToken.None).Result); }