コード例 #1
0
        public async Task API_StartTest()
        {
            var widget  = new TestWidget();
            var handler = new Start();
            var request = StartRequest.Create(widget);

            await handler.Handle(request, CancellationToken.None);
        }
コード例 #2
0
        public async Task API_HealthCheckTest()
        {
            var widget  = new TestWidget();
            var handler = new CheckHealth();
            var request = HealthCheckRequest.Create(widget);

            await handler.Handle(request, CancellationToken.None);
        }
コード例 #3
0
        public async Task API_InitializeTest()
        {
            var widget  = new TestWidget();
            var handler = new Initializer();
            var request = InitializeRequest.Create(widget);

            await handler.Handle(request, CancellationToken.None);
        }
コード例 #4
0
        public async Task API_OpenWebPageTest()
        {
            var widget  = new TestWidget();
            var handler = new OpenWebPage();
            var request = OpenWebPageRequest.Create(widget);

            await handler.Handle(request, CancellationToken.None);
        }
コード例 #5
0
        public async Task API_MetricQueryTest()
        {
            var widget  = new TestWidget();
            var handler = new MetricQuery();
            var request = MetricQueryRequest.Create(widget);

            await handler.Handle(request, CancellationToken.None);

            Assert.AreEqual(1, widget.Value);
        }
コード例 #6
0
ファイル: OpenWebPage.cs プロジェクト: tobysmith568/API
        public async Task API_OpenWebPageTest2()
        {
            var processStarter = Substitute.For <IProcessStarter>();

            const string url = "invalid-uri";

            var widget = new TestWidget
            {
                URL = url
            };

            var handler = new OpenWebPage <TestWidget>(processStarter);
            var request = OpenWebPageRequest.Create(widget);

            await handler.Handle(request, CancellationToken.None);
        }
コード例 #7
0
ファイル: OpenWebPage.cs プロジェクト: tobysmith568/API
        public async Task API_OpenWebPageTest()
        {
            var processStarter = Substitute.For <IProcessStarter>();

            const string URL = "https://test-url.com";

            var widget = new TestWidget
            {
                URL = URL
            };

            var handler = new OpenWebPage <TestWidget>(processStarter);
            var request = OpenWebPageRequest.Create(widget);

            await handler.Handle(request, CancellationToken.None);

            processStarter.Received().Start(URL);
        }