public void Test()
        {
            var rootPath      = Path.Combine(AppContext.BaseDirectory, "TestData", "Sample");
            var listSubpath   = "list";
            var singleSubpath = "single";
            var fileProvider  = new PhysicalFileProvider(rootPath);
            var lLogger       = new LoggerFactory().CreateLogger <ListHttpRequestMessageProvider>();
            var sLogger       = new LoggerFactory().CreateLogger <SingleRequestMessageProvider>();

            var listProvider      = new ListHttpRequestMessageProvider(listSubpath, fileProvider, lLogger);
            var singleProvider    = new SingleRequestMessageProvider(singleSubpath, fileProvider, sLogger);
            var compositeProvider = new CompositeRequestMessageProvider(listProvider, singleProvider);

            var results = compositeProvider.Get();

            Assert.Equal(21, results.Count());
        }
Beispiel #2
0
        public void RequestListParseTest()
        {
            var rootPath     = Path.Combine(AppContext.BaseDirectory, "TestData", "Sample");
            var subpath      = "list";
            var fileProvider = new PhysicalFileProvider(rootPath);
            var lLogger      = new LoggerFactory().CreateLogger <ListHttpRequestMessageProvider>();

            var provider = new ListHttpRequestMessageProvider(subpath, fileProvider, lLogger);

            var messages = provider.Get();

            Assert.Equal(18, messages.Count());
            Assert.True(messages.All(x => x.Method == HttpMethod.Get));

            Assert.Equal("/", messages.ElementAt(0).RequestUri.ToString());
            Assert.Equal("/home", messages.ElementAt(1).RequestUri.ToString());
            Assert.Equal("/home/index", messages.ElementAt(2).RequestUri.ToString());
            Assert.Equal("/home/index/5", messages.ElementAt(3).RequestUri.ToString());
            Assert.Equal("/0002", messages.ElementAt(4).RequestUri.ToString());
        }