public async Task EnsuresArgumentsNotNull() { var client = Substitute.For <IApiConnection>(); var authEndpoint = new AuthorizationsClient(client); await Assert.ThrowsAsync <ArgumentNullException>(() => authEndpoint.ResetApplicationAuthentication(null, "accessToken")); await Assert.ThrowsAsync <ArgumentException>(() => authEndpoint.ResetApplicationAuthentication("", "accessToken")); await Assert.ThrowsAsync <ArgumentNullException>(() => authEndpoint.ResetApplicationAuthentication("clientId", null)); await Assert.ThrowsAsync <ArgumentException>(() => authEndpoint.ResetApplicationAuthentication("clientId", "")); }
public async Task ResetsApplicationAuthenticationAtCorrectUrl() { var client = Substitute.For <IApiConnection>(); var authEndpoint = new AuthorizationsClient(client); authEndpoint.ResetApplicationAuthentication("clientId", "accessToken"); client.Received().Post <ApplicationAuthorization>( Arg.Is <Uri>(u => u.ToString() == "applications/clientId/tokens/accessToken"), Args.Object); }
public async Task ResetsApplicationAuthenticationAtCorrectUrl() { var client = Substitute.For <IApiConnection>(); var authEndpoint = new AuthorizationsClient(client); authEndpoint.ResetApplicationAuthentication("clientId", "accessToken"); client.Received().Patch <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.ResetApplicationAuthentication(null, "accessToken")); await Assert.ThrowsAsync<ArgumentException>(() => authEndpoint.ResetApplicationAuthentication("", "accessToken")); await Assert.ThrowsAsync<ArgumentNullException>(() => authEndpoint.ResetApplicationAuthentication("clientId", null)); await Assert.ThrowsAsync<ArgumentException>(() => authEndpoint.ResetApplicationAuthentication("clientId", "")); }
public async Task ResetsApplicationAuthenticationAtCorrectUrl() { var client = Substitute.For<IApiConnection>(); var authEndpoint = new AuthorizationsClient(client); authEndpoint.ResetApplicationAuthentication("clientId", "accessToken"); client.Received().Post<ApplicationAuthorization>( Arg.Is<Uri>(u => u.ToString() == "applications/clientId/tokens/accessToken"), Args.Object); }