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);
        }
示例#4
0
 public ProxyRelayCallService(IStorageApiClient storageApiClient, IRelayApiClient relayApiClient)
 {
     _storageApiClient = storageApiClient;
     _relayApiClient   = relayApiClient;
 }