public async Task EnsuresArgumentsNotNull() { var client = Substitute.For <IApiConnection>(); var authEndpoint = new AuthorizationsClient(client); await Assert.ThrowsAsync <ArgumentNullException>(() => authEndpoint.CheckApplicationAuthentication(null, "accessToken")); await Assert.ThrowsAsync <ArgumentException>(() => authEndpoint.CheckApplicationAuthentication("", "accessToken")); await Assert.ThrowsAsync <ArgumentNullException>(() => authEndpoint.CheckApplicationAuthentication("clientId", null)); await Assert.ThrowsAsync <ArgumentException>(() => authEndpoint.CheckApplicationAuthentication("clientId", "")); }
public async Task ChecksApplicationAuthenticateAtCorrectUrl() { var client = Substitute.For <IApiConnection>(); var authEndpoint = new AuthorizationsClient(client); authEndpoint.CheckApplicationAuthentication("clientId", "accessToken"); client.Received().Get <ApplicationAuthorization>( Arg.Is <Uri>(u => u.ToString() == "applications/clientId/tokens/accessToken"), null); }
public async Task ChecksApplicationAuthenticateAtCorrectUrl() { var client = Substitute.For <IApiConnection>(); var authEndpoint = new AuthorizationsClient(client); authEndpoint.CheckApplicationAuthentication("clientId", "accessToken"); client.Received().Post <ApplicationAuthorization>( Arg.Is <Uri>(u => u.ToString() == "applications/clientId/token"), Arg.Is <Object>(o => o.GetType().GetProperty("access_token").GetValue(o).ToString() == "accessToken")); }
public async Task EnsuresArgumentsNotNull() { var client = Substitute.For<IApiConnection>(); var authEndpoint = new AuthorizationsClient(client); await Assert.ThrowsAsync<ArgumentNullException>(() => authEndpoint.CheckApplicationAuthentication(null, "accessToken")); await Assert.ThrowsAsync<ArgumentException>(() => authEndpoint.CheckApplicationAuthentication("", "accessToken")); await Assert.ThrowsAsync<ArgumentNullException>(() => authEndpoint.CheckApplicationAuthentication("clientId", null)); await Assert.ThrowsAsync<ArgumentException>(() => authEndpoint.CheckApplicationAuthentication("clientId", "")); }
public async Task ChecksApplicationAuthenticateAtCorrectUrl() { var client = Substitute.For<IApiConnection>(); var authEndpoint = new AuthorizationsClient(client); authEndpoint.CheckApplicationAuthentication("clientId", "accessToken"); client.Received().Get<ApplicationAuthorization>( Arg.Is<Uri>(u => u.ToString() == "applications/clientId/tokens/accessToken"), null); }