示例#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));
    }
示例#2
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();
    }