Beispiel #1
0
        public void TestCredentialsCannotBeMutated()
        {
            var connection = new MutableSessionConfig("localhost");
            var anonymous  = new MutableWebApiCredentialsPOD(null, null);

            var defaultSource = LegacyConstants.DefaultSource();

            var session = new ScApiSession(connection, anonymous, this.mediaSettings, defaultSource);

            Assert.AreEqual(defaultSource, session.DefaultSource);
            Assert.AreNotSame(defaultSource, session.DefaultSource);

            anonymous.Username = "******";
            anonymous.Password = "******";

            Assert.AreNotEqual(anonymous, session.Credentials);
            Assert.AreNotSame(anonymous, session.Credentials);
        }
Beispiel #2
0
        public void TestSessionConfigCannotBeMutated()
        {
            var connection = new MutableSessionConfig("localhost");
            var anonymous  = new MutableWebApiCredentialsPOD(null, null);

            var defaultSource = LegacyConstants.DefaultSource();

            var session = new ScApiSession(connection, anonymous, this.mediaSettings, defaultSource);

            Assert.AreEqual(defaultSource, session.DefaultSource);
            Assert.AreNotSame(defaultSource, session.DefaultSource);

            connection.SetInstanceUrl("sitecore.net");
            connection.SetSite("/sitecore/shell");
            connection.SetItemWebApiVersion("v100500");

            anonymous.Username = "******";
            anonymous.Password = "******";

            Assert.AreNotEqual(connection, session.Config);
            Assert.AreNotSame(connection, session.Config);
        }