Exemple #1
0
    public static void PostConfigure_Throws_If_Domain_Is_Invalid(string value)
    {
        // Arrange
        string name   = "Zendesk";
        var    target = new ZendeskPostConfigureOptions();

        var options = new ZendeskAuthenticationOptions()
        {
            Domain = value,
        };

        // Act and Assert
        Assert.Throws <ArgumentException>("options", () => target.PostConfigure(name, options));
    }
Exemple #2
0
    public static void Validate_Throws_If_UserInformationEndpoint_Not_Set()
    {
        // Arrange
        var options = new ZendeskAuthenticationOptions()
        {
            AuthorizationEndpoint = "https://glowingwaffle.zendesk.com",
            ClientId      = "ClientId",
            ClientSecret  = "ClientSecret",
            TokenEndpoint = "https://glowingwaffle.zendesk.com",
        };

        // Act and Assert
        Assert.Throws <ArgumentException>("UserInformationEndpoint", () => options.Validate());
    }
Exemple #3
0
    public static void PostConfigure_Configures_Valid_Endpoints(string domain)
    {
        // Arrange
        string name   = "Zendesk";
        var    target = new ZendeskPostConfigureOptions();

        var options = new ZendeskAuthenticationOptions()
        {
            Domain = domain,
        };

        // Act
        target.PostConfigure(name, options);

        // Assert
        options.AuthorizationEndpoint.ShouldStartWith("https://glowingwaffle.zendesk.com/oauth/authorizations/new");
        Uri.TryCreate(options.AuthorizationEndpoint, UriKind.Absolute, out _).ShouldBeTrue();

        options.TokenEndpoint.ShouldStartWith("https://glowingwaffle.zendesk.com/oauth/tokens");
        Uri.TryCreate(options.TokenEndpoint, UriKind.Absolute, out _).ShouldBeTrue();

        options.UserInformationEndpoint.ShouldStartWith("https://glowingwaffle.zendesk.com/api/v2/users/me");
        Uri.TryCreate(options.UserInformationEndpoint, UriKind.Absolute, out _).ShouldBeTrue();
    }