public async Task ShouldInitializeProperly() { // Given Assert.IsNull(m_applications.Application); Assert.IsFalse(m_restfulClient.RequestsProcessed("GET " + DataUrls.Applications)); // When await m_applications.RefreshAndInitializeAsync(m_loggingContext).ConfigureAwait(false); // Then Assert.IsNotNull(m_applications.Application); Assert.IsTrue(m_restfulClient.RequestsProcessed("GET " + DataUrls.Applications)); }
/// <summary> /// Initialize the Application. /// </summary> /// <param name="loggingContext">The logging context.</param> /// <returns>The task.</returns> public async Task InitializeApplicationAsync(LoggingContext loggingContext) { if (Application == null) { Uri discoverUri = ClientPlatform.DiscoverUri; Uri baseUri = UriHelper.GetBaseUriFromAbsoluteUri(discoverUri.ToString()); var discover = new Discover(m_restfulClient, baseUri, discoverUri, this); await discover.RefreshAndInitializeAsync(loggingContext, ApplicationEndpointId.ToString()).ConfigureAwait(false); IApplications ApplicationsResource = discover.Applications; await ApplicationsResource.RefreshAndInitializeAsync(loggingContext).ConfigureAwait(false); Application = ApplicationsResource.Application; await Application.RefreshAndInitializeAsync(loggingContext).ConfigureAwait(false); } }
public async void TestSetup() { m_restfulClient = new MockRestfulClient(); Logger.RegisterLogger(new ConsoleLogger()); m_loggingContext = new LoggingContext(Guid.NewGuid()); TestHelper.InitializeTokenMapper(); Uri discoverUri = TestHelper.DiscoverUri; Uri baseUri = UriHelper.GetBaseUriFromAbsoluteUri(discoverUri.ToString()); SipUri ApplicationEndpointId = TestHelper.ApplicationEndpointUri; var discover = new Discover(m_restfulClient, baseUri, discoverUri, this); await discover.RefreshAndInitializeAsync(ApplicationEndpointId.ToString(), m_loggingContext).ConfigureAwait(false); IApplications ApplicationsResource = discover.Applications; await ApplicationsResource.RefreshAndInitializeAsync(m_loggingContext).ConfigureAwait(false); m_application = ApplicationsResource.Application; }