public async Task GivenEmptyPathFeature_WhenQueryByNameMatches_ThenWeReturnTheResults()
        {
            var path            = string.Empty;
            var name            = "name";
            var expectedResults = new FeatureAndStrategyConfiguration
            {
                Path       = string.Empty,
                Feature    = name,
                State      = FeatureState.Published,
                Strategies = new List <IFeatureStrategy>()
                {
                    new FeatureStrategy {
                        Name = "one", Value = "two"
                    }
                }
            };

            var handler = this
                          .GivenIHandleQuery <GetFeatureQuery, FeatureAndStrategyConfiguration>()
                          .WithResults(expectedResults);

            await this
            .GivenController(handler.Object)
            .WhenProcessingQuery(path, name)
            .ThenWeReturnFeatureAndStrategies(expectedResults, handler);
        }
        public static async Task ThenWeReturnFeatureAndStrategies(
            this Func <Task <FeatureAndStrategyConfiguration> > processingFunc,
            FeatureAndStrategyConfiguration expectedResult,
            Mock <IHandleQuery <GetFeatureQuery, FeatureAndStrategyConfiguration> > handler)
        {
            var results = await processingFunc();

            results.Should().BeEquivalentTo(expectedResult);
            handler.Verify(_ => _.Handle(It.Is <GetFeatureQuery>(q =>
                                                                 q.Name.Equals(expectedResult.Feature) &&
                                                                 q.Path.Equals(expectedResult.Path))), Times.Once);
        }
        public async Task GivenAFilterQueryString_WhenQueryReturnsResults_ThenWeReturnTheResults()
        {
            var expectedResults = new FeatureAndStrategyConfiguration
            {
                Path    = "bob/painting",
                Feature = "ross&friends"
            };

            var path = WebUtility.UrlEncode("bob/painting");
            var name = WebUtility.UrlEncode("ross&friends");

            var handler = this
                          .GivenIHandleQuery <GetFeatureQuery, FeatureAndStrategyConfiguration>()
                          .WithResults(expectedResults);

            await this
            .GivenController(handler.Object)
            .WhenProcessingQuery(path, name)
            .ThenWeReturnFeatureAndStrategies(expectedResults, handler);
        }