コード例 #1
0
            public void Setup()
            {
                ResetSubject();

                httpClient = new HttpClient();

                apiHost = "http://test.com";
                apiKey  = Guid.NewGuid().ToString();

                var settings = new Client.Settings();

                settings.BuildHttpClientsUsing(() => httpClient);
                Mocked <IClient>().Setup(x => x.CustomSettings).Returns(settings);
                Mocked <IClient>().Setup(x => x.ApiHost).Returns(apiHost);
                Mocked <IClient>().Setup(x => x.ApiKey).Returns(apiKey);

                request = new Request();

                defaultHttpResponseMessage = new HttpResponseMessage(HttpStatusCode.Accepted)
                {
                    Content = new StringContent(Guid.NewGuid().ToString())
                };
            }
コード例 #2
0
            public SendTests()
            {
                var httpClient = new HttpClient();

                apiHost = "http://test.com";
                apiKey  = Guid.NewGuid().ToString();

                var settings = new Client.Settings();

                settings.BuildHttpClientsUsing(() => httpClient);
                client = new Mock <IClient>();
                client.Setup(x => x.CustomSettings).Returns(settings);
                client.Setup(x => x.ApiHost).Returns(apiHost);
                client.Setup(x => x.ApiKey).Returns(apiKey);

                asyncTesting = new SendTests.AsyncTesting(client.Object);

                request = new Request();

                defaultHttpResponseMessage = new HttpResponseMessage(HttpStatusCode.Accepted)
                {
                    Content = new StringContent(Guid.NewGuid().ToString())
                };
            }