Esempio n. 1
0
    public static void PostConfigure_Throws_If_Domain_Is_Invalid(string value)
    {
        // Arrange
        string name   = "Moodle";
        var    target = new MoodlePostConfigureOptions();

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

        // Act and Assert
        Assert.Throws <ArgumentException>("options", () => target.PostConfigure(name, options));
    }
Esempio n. 2
0
    public static void PostConfigure_Configures_Valid_Endpoints(string domain)
    {
        // Arrange
        string name   = "Moodle";
        var    target = new MoodlePostConfigureOptions();

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

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

        // Assert
        options.AuthorizationEndpoint.ShouldStartWith("https://moodle.local/local/oauth/login.php");
        Uri.TryCreate(options.AuthorizationEndpoint, UriKind.Absolute, out _).ShouldBeTrue();

        options.TokenEndpoint.ShouldStartWith("https://moodle.local/local/oauth/token.php");
        Uri.TryCreate(options.TokenEndpoint, UriKind.Absolute, out _).ShouldBeTrue();

        options.UserInformationEndpoint.ShouldStartWith("https://moodle.local/local/oauth/user_info.php");
        Uri.TryCreate(options.UserInformationEndpoint, UriKind.Absolute, out _).ShouldBeTrue();
    }