public void TestApiSessionConstructorRequiresConfig() { ItemSource defaultSource = LegacyConstants.DefaultSource(); TestDelegate initSessionAction = () => { ScApiSession result = new ScApiSession(null, this.credentials, this.mediaSettings, defaultSource); Debug.WriteLine( result ); }; Assert.Throws<ArgumentNullException>(initSessionAction); }
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); }
public void TestSessionDefaultSourceCannotBeMutated() { var connection = new SessionConfig("localhost"); var defaultSource = new MutableItemSource("master", "en"); var session = new ScApiSession(connection, null, this.mediaSettings, defaultSource); Assert.AreEqual(defaultSource, session.DefaultSource); Assert.AreNotSame(defaultSource, session.DefaultSource); defaultSource.SetDatabase("web"); defaultSource.SetLanguage("da"); defaultSource.SetVersion(100500); Assert.AreNotEqual(defaultSource, session.DefaultSource); Assert.AreNotSame(defaultSource, session.DefaultSource); }
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); }
public void TestApiSessionConstructorDoesNotRequiresDefaultSource() { ScApiSession result = new ScApiSession(this.localhostConnection, this.credentials, this.mediaSettings, null); Assert.IsNotNull(result); }