コード例 #1
0
        public void GetSitecoreConfigClientUrlHostNotFound()
        {
            var mockCxSettings = new Mock <ISitecoreConnectionSettings>();

            mockCxSettings.SetupGet(cxSettings => cxSettings.ClientUrl).Returns("http://localhost/sitecore");
            var manager  = new SitecoreConnectionManager(mockCxSettings.Object);
            var response = manager.GetSitecoreConfig();

            Assert.IsNotNull(response);
            Assert.IsNull(response.Data);
            Assert.IsNotNull(response.GetExceptions());
            Assert.IsTrue(response.GetExceptions().Any(ex => ex.GetType() == typeof(WebException)));
        }
コード例 #2
0
        public void GetSitecoreConfigPasswordIncorrect()
        {
            var mockCxSettings = new Mock <ISitecoreConnectionSettings>();

            mockCxSettings.SetupGet(cxSettings => cxSettings.Username).Returns(@"sitecore\admin");
            mockCxSettings.SetupGet(cxSettings => cxSettings.Password).Returns("xxxx");
            mockCxSettings.SetupGet(cxSettings => cxSettings.ClientUrl).Returns("http://sc80/sitecore");
            var manager  = new SitecoreConnectionManager(mockCxSettings.Object);
            var response = manager.GetSitecoreConfig();

            Assert.IsNotNull(response);
            Assert.IsNull(response.Data);
            Assert.IsNotNull(response.GetExceptions());
            Assert.IsTrue(response.GetExceptions().Any(ex => ex.GetType() == typeof(AuthenticationException)));
        }
コード例 #3
0
        public void GetSitecoreConfigSitecore80()
        {
            var mockCxSettings = new Mock <ISitecoreConnectionSettings>();

            mockCxSettings.SetupGet(cxSettings => cxSettings.Username).Returns(@"sitecore\admin");
            mockCxSettings.SetupGet(cxSettings => cxSettings.Password).Returns("b");
            mockCxSettings.SetupGet(cxSettings => cxSettings.ClientUrl).Returns("http://sc80/sitecore");
            var manager  = new SitecoreConnectionManager(mockCxSettings.Object);
            var response = manager.GetSitecoreConfig();

            Assert.IsNotNull(response);
            Assert.IsNotNull(response.Data);
            Assert.IsNotNull(response.GetExceptions());
            Assert.IsFalse(response.GetExceptions().Any());
        }