public void GetAllNoEntriesListTest()
        {
            #region Test Setup

            var options = new MemoryCacheOptions();
            var cache   = new MemoryCache(options);

            var getAllMockDefinitionsCommand = new GetAllMockDefinitionsCommand(ref TestUtils.databaseLock);
            #endregion

            var Target = new GetAllMockDefinitionsHandler(cache, data);
            var Actual = Target.Handle(getAllMockDefinitionsCommand, CancellationToken.None).Result;

            Assert.Empty(Actual);
        }
        public void GetAllEntriesSuccessTest()
        {
            #region Test Setup

            var metadataFake = new Faker <MetadataInfo>()
                               .RuleFor(m => m.Title, f => f.Lorem.Sentence())
                               .RuleFor(m => m.Description, f => f.Lorem.Paragraph());

            var mockDefinitionFake = new Faker <MockDefinition>()
                                     .RuleFor(m => m.Host, f => f.Internet.DomainName())
                                     .RuleFor(m => m.Metadata, f => metadataFake.Generate());

            var options = new MemoryCacheOptions();
            var cache   = new MemoryCache(options);

            var mockdeffake1 = mockDefinitionFake.Generate();
            var mockdeffake2 = new MockDefinition {
                Host = mockdeffake1.Host + "diff", Metadata = mockdeffake1.Metadata
            };

            cache.Set(data.mockIds, new List <string> {
                mockdeffake1.Metadata.Title, mockdeffake2.Metadata.Title
            });
            cache.Set(mockdeffake1.Metadata.Title, mockdeffake1);
            cache.Set(mockdeffake2.Metadata.Title, mockdeffake2);

            var getAllMockDefinitionsCommand = new GetAllMockDefinitionsCommand(ref TestUtils.databaseLock);

            var Target = new GetAllMockDefinitionsHandler(cache, data);
            var Actual = Target.Handle(getAllMockDefinitionsCommand, CancellationToken.None).Result.ToList();

            Assert.Equal(2, Actual.Count);
            Assert.Equal(mockdeffake1.Metadata.Title, Actual[0].Metadata.Title);
            Assert.Equal(mockdeffake2.Metadata.Title, Actual[1].Metadata.Title);

            #endregion
        }