public async Task ThrowInvalidOperationExceptionWhenCloudProviderDidNotReturnHybridConnectionAsync() { // Arrange IStorageApiClient storageApiClient = A.Fake <IStorageApiClient>(); ICloudProviderHandlerApiClient cloudProviderHandlerApiClient = A.Fake <ICloudProviderHandlerApiClient>(); IRelayManagementService sut = new RelayManagementService(storageApiClient, cloudProviderHandlerApiClient); A.CallTo(() => cloudProviderHandlerApiClient.CreateRelayHybridConnection(TestHelper.TenantId.ToString())).WithAnyArguments().Returns <HybridConnectionDto>(null); // Act & Assert await Assert.ThrowsAsync <InvalidOperationException>(() => sut.StoreRelayAsync(TestHelper.GetCreateRelayStorageDto())); }
public async Task ReturnHybridConnectionDtoWhenGetRelayIsCalledAsync() { // Arrange IStorageApiClient storageApiClient = A.Fake <IStorageApiClient>(); ICloudProviderHandlerApiClient cloudProviderHandlerApiClient = A.Fake <ICloudProviderHandlerApiClient>(); IRelayManagementService sut = new RelayManagementService(storageApiClient, cloudProviderHandlerApiClient); A.CallTo(() => storageApiClient.GetRelayFromIdAsync(TestHelper.TenantId.ToString())).Returns(TestHelper.GetHybridConnectionDto()); // Act HybridConnectionDto actual = await sut.GetRelayAsync(TestHelper.TenantId.ToString()); // Assert Assert.Equal(TestHelper.GetHybridConnectionDto().HybridConnectionUrl, actual.HybridConnectionUrl); }
public RelayManagementService(IStorageApiClient storageApiClient, ICloudProviderHandlerApiClient cloudProviderHandlerApiClient) { _storageApiClient = storageApiClient; _cloudProviderHandlerApiClient = cloudProviderHandlerApiClient; }