public void WithInValidUserNameShouldThrowException()
        {
            // Arrange
            var client = new MagentoApi()
                .Initialize(Url, ConsumerKey, ConsumerSecret)
                .SetCustomAdminUrlPart(CustomAdminUrlPart);

            // Act & assert
            Assert.Throws<MagentoApiException>(() => client.AuthenticateAdmin("y", "z"));
        }
        public void WithInValidUrlShouldThrowException()
        {
            // Arrange
            var client = new MagentoApi()
                .Initialize("http://some.invalid.url.123.be", "w", "x")
                .SetCustomAdminUrlPart("");

            // Act & assert
            Assert.Throws<MagentoApiException>(() => client.AuthenticateAdmin("y", "z"));
        }
Beispiel #3
0
        public void WithInValidPasswordShouldThrowException()
        {
            // Arrange
            var client = new MagentoApi()
                         .Initialize(Url, ConsumerKey, ConsumerSecret)
                         .SetCustomAdminUrlPart(CustomAdminUrlPart);

            // Act & assert
            Assert.Throws <MagentoApiException>(() => client.AuthenticateAdmin(UserName, "z"));
        }
Beispiel #4
0
        public void WithInValidAdminUrlPartShouldThrowException()
        {
            // Arrange
            var client = new MagentoApi()
                         .Initialize(Url, ConsumerKey, ConsumerSecret)
                         .SetCustomAdminUrlPart("invalidcustomadminurlpart");

            // Act & assert
            Assert.Throws <MagentoApiException>(() => client.AuthenticateAdmin("y", "z"));
        }
Beispiel #5
0
        public void WithInValidConsumerKeyShouldThrowException()
        {
            // Arrange
            var client = new MagentoApi()
                         .Initialize(Url, "w", "x")
                         .SetCustomAdminUrlPart("");

            // Act & assert
            Assert.Throws <MagentoApiException>(() => client.AuthenticateAdmin("y", "z"));
        }
Beispiel #6
0
        public void WithInValidUrlShouldThrowException()
        {
            // Arrange
            var client = new MagentoApi()
                         .Initialize("http://some.invalid.url.123.be", "w", "x")
                         .SetCustomAdminUrlPart("");

            // Act & assert
            Assert.Throws <MagentoApiException>(() => client.AuthenticateAdmin("y", "z"));
        }
Beispiel #7
0
 protected IMagentoApi InitializeClient()
 {
     lock (_object)
     {
         var uri = new Uri(Url);
         if (!magentoApis.ContainsKey(uri.Host))
         {
             var api = new MagentoApi()
                       .SetCustomAdminUrlPart(CustomAdminUrlPart)
                       .Initialize(Url, ConsumerKey, ConsumerSecret)
                       .AuthenticateAdmin(UserName, Password);
             magentoApis.Add(uri.Host, api);
         }
         return(magentoApis[uri.Host]);
     }
 }
Beispiel #8
0
 protected IMagentoApi InitializeClient()
 {
     lock (_object)
     {
         var uri = new Uri(Url);
         if (!magentoApis.ContainsKey(uri.Host))
         {
             var api = new MagentoApi()
                 .SetCustomAdminUrlPart(CustomAdminUrlPart)
                 .Initialize(Url, ConsumerKey, ConsumerSecret)
                 .AuthenticateAdmin(UserName, Password);
             magentoApis.Add(uri.Host, api);
         }
         return magentoApis[uri.Host];
     }
 }