public async Task ThrowArgumentNullExceptionWhenNoTenantIdAsync() { // Arrange IStorageApiClient storageApiClient = A.Fake <IStorageApiClient>(); IRelayApiClient relayApiClient = A.Fake <IRelayApiClient>(); IProxyRelayCallService sut = new ProxyRelayCallService(storageApiClient, relayApiClient); // Act & Assert await Assert.ThrowsAsync <ArgumentNullException>(() => sut.ProxyRelayCallAsync("", "body", new HttpMethod(HttpMethods.Post), null, "test/endpoint")); }
public async Task ThrowArgumentNullExceptionWhenNoUrlIsPresentAsync() { // Arrange IStorageApiClient storageApiClient = A.Fake <IStorageApiClient>(); IRelayApiClient relayApiClient = A.Fake <IRelayApiClient>(); IProxyRelayCallService sut = new ProxyRelayCallService(storageApiClient, relayApiClient); // Act & Assert await Assert.ThrowsAsync <ArgumentNullException>(() => sut.ProxyRelayCallAsync(TestHelper.TenantId.ToString(), "body", new HttpMethod(HttpMethods.Post), null, "")); }
public async Task ReturnStatusCodeOkayWhenProxyRelayWasSuccessfulAsync() { // Arrange IStorageApiClient storageApiClient = A.Fake <IStorageApiClient>(); IRelayApiClient relayApiClient = A.Fake <IRelayApiClient>(); IProxyRelayCallService sut = new ProxyRelayCallService(storageApiClient, relayApiClient); A.CallTo(() => relayApiClient.RelayCallAsync(new RelayCallDto(TestHelper.GetHybridConnectionDto(), "body", new HttpMethod(HttpMethods.Post), null, "test/endpoint"))) .Returns(new HttpResponseMessage(HttpStatusCode.OK)); // Act HttpResponseMessage actual = await sut.ProxyRelayCallAsync(TestHelper.TenantId.ToString(), "body", new HttpMethod(HttpMethods.Post), null, "test/endpoint"); // Assert Assert.Equal(HttpStatusCode.OK, actual.StatusCode); }