Exemple #1
0
        public void OAuthUri_BuildsCorrectUriWithResources()
        {
            var request = new OAuthRedirectBuilderStub("ClientID", HttpUtility.UrlEncode("https://jobseeker.careerbuilder.com/MyCareerBuilder"), "Resources", "api.careerbuilder.com");
            var uri     = request.OAuthUri();

            Assert.AreEqual("https://api.careerbuilder.com/auth/prompt?client_id=ClientID&redirect_uri=https%3a%2f%2fjobseeker.careerbuilder.com%2fMyCareerBuilder&resources=Resources", uri.AbsoluteUri);
        }
        public void Constructor_ThrowsException_WhenPassedNullOrEmptyDomain() {
            try {
                var request = new OAuthRedirectBuilderStub("ClientID", "redirectURI", "", "");
                Assert.Fail("Should have thrown exception");
            } catch (ArgumentNullException ex) {
                Assert.IsInstanceOfType(ex, typeof(ArgumentNullException));
            }

            try {
                var request = new OAuthRedirectBuilderStub("ClientID", "redirectURI", "", null);
                Assert.Fail("Should have thrown exception");
            } catch (ArgumentNullException ex) {
                Assert.IsInstanceOfType(ex, typeof(ArgumentNullException));
            }
        }
Exemple #3
0
        public void Constructor_ThrowsException_WhenPassedNullOrEmptyDomain()
        {
            try {
                var request = new OAuthRedirectBuilderStub("ClientID", "redirectURI", "", "");
                Assert.Fail("Should have thrown exception");
            } catch (ArgumentNullException ex) {
                Assert.IsInstanceOf <ArgumentNullException>(ex);
            }

            try {
                var request = new OAuthRedirectBuilderStub("ClientID", "redirectURI", "", null);
                Assert.Fail("Should have thrown exception");
            } catch (ArgumentNullException ex) {
                Assert.IsInstanceOf <ArgumentNullException>(ex);
            }
        }
        public void Constructor_ThrowsException_WhenPassedNullOrEmptyRedirectUri()
        {
            try {
                var request = new OAuthRedirectBuilderStub("ClientID", "", "", "api.careerbuilder.com");
                Assert.Fail("Should have thrown exception");
            } catch (ArgumentNullException ex) {
                Assert.IsInstanceOfType(ex, typeof(ArgumentNullException));
            }

            try {
                var request = new OAuthRedirectBuilderStub("ClientID", null, "", "api.careerbuilder.com");
                Assert.Fail("Should have thrown exception");
            } catch (ArgumentNullException ex) {
                Assert.IsInstanceOfType(ex, typeof(ArgumentNullException));
            }
        }
Exemple #5
0
        public void Constructor_SetsClientID()
        {
            var request = new OAuthRedirectBuilderStub("ClientID", "redirectURI", "", "api.careerbuilder.com");

            Assert.AreEqual("ClientID", request.ClientId);
        }
 public void Constructor_SetsClientID() {
     var request = new OAuthRedirectBuilderStub("ClientID", "redirectURI","","api.careerbuilder.com");
     Assert.AreEqual("ClientID", request.ClientId);
 }
 public void OAuthUri_BuildsCorrectUriWithResources() {
     var request = new OAuthRedirectBuilderStub("ClientID", HttpUtility.UrlEncode("https://jobseeker.careerbuilder.com/MyCareerBuilder"), "Resources", "api.careerbuilder.com");
     var uri = request.OAuthUri();
     Assert.AreEqual("https://api.careerbuilder.com/auth/prompt?client_id=ClientID&redirect_uri=https%3a%2f%2fjobseeker.careerbuilder.com%2fMyCareerBuilder&resources=Resources", uri.AbsoluteUri);
 }