public async Task TestResponseReturnedCorrectlyAsync() { var expectedResponse = new Response(200, null); var mockSender = new MockSender(expectedResponse); var sender = new SigningSender(this.signer, mockSender); var result = await sender.SendAsync(new Request()); Assert.AreEqual(expectedResponse, result); }
public void TestResponseReturnedCorrectly() { var expectedResponse = new Response(200, null); var mockSender = new MockSender(expectedResponse); var sender = new SigningSender(this.signer, mockSender); Assert.AreEqual( expectedResponse, sender.Send(new Request())); }
public void TestLicensesNotAdded() { var mockSender = new MockSender(null); var urlPrefixSender = new URLPrefixSender("http://localhost/", mockSender); var sender = new LicenseSender(new List <string>(), urlPrefixSender); sender.Send(new Request()); Assert.False(mockSender.Request.GetUrl().Contains("license=")); }
public void TestResponseReturnedCorrectly() { var signer = new StaticCredentials("id", "secret"); var expectedResponse = new Response(200, null); var mockSender = new MockSender(expectedResponse); var sender = new SigningSender(signer, mockSender); var actualResponse = sender.Send(new Request("http://localhost/")); Assert.AreEqual(expectedResponse, actualResponse); }
public void TestSigningOfRequest() { var signer = new StaticCredentials("id", "secret"); var mockSender = new MockSender(null); var sender = new SigningSender(signer, mockSender); sender.Send(new Request("http://localhost/")); var url = mockSender.Request.GetUrl(); Assert.AreEqual("http://localhost/?auth-id=id&auth-token=secret", url); }
public void TestSigningOfRequest() { var mockSender = new MockSender(null); var urlPrefixSender = new URLPrefixSender("http://localhost/", mockSender); var sender = new SigningSender(this.signer, urlPrefixSender); sender.Send(new Request()); Assert.AreEqual( "http://localhost/?auth-id=id&auth-token=secret", mockSender.Request.GetUrl()); }
public void TestAddingLicenses() { var licenses = new List <string> { "one", "two", "three" }; var mockSender = new MockSender(null); var urlPrefixSender = new URLPrefixSender("http://localhost/", mockSender); var sender = new LicenseSender(licenses, urlPrefixSender); sender.Send(new Request()); Assert.AreEqual("license=one%2Ctwo%2Cthree", mockSender.Request.GetUrl().Split("?")[1]); }
public void TestAddingHeaders() { var headers = new Dictionary <string, string> { ["Test1"] = "value1", ["Test2"] = "value2" }; var mockSender = new MockSender(null); var urlPrefixSender = new URLPrefixSender("http://localhost/", mockSender); var sender = new CustomHeaderSender(headers, urlPrefixSender); sender.Send(new Request()); Assert.AreEqual("value1", mockSender.Request.Headers["Test1"]); Assert.AreEqual("value2", mockSender.Request.Headers["Test2"]); }