Ejemplo n.º 1
0
        public void WhenUsernameSetInProject_ProjectValueIsInheritedDownToVm(
            [Values("user", null)]
            string username)
        {
            this.project.Username = username;

            this.instanceA.Username = null;
            this.instanceB.Username = "";

            // Inherited value is shown...
            Assert.AreEqual(username, instanceA.Username);
            Assert.AreEqual(username, instanceB.Username);

            // ...and takes effect.
            Assert.AreEqual(username, instanceA.CreateConnectionSettings("instance").Username);
            Assert.AreEqual(username, instanceB.CreateConnectionSettings("instance").Username);

            Assert.IsFalse(instanceA.ShouldSerializeUsername());
            Assert.IsFalse(instanceB.ShouldSerializeUsername());
        }
Ejemplo n.º 2
0
        public void WhenUsernameSetInProjectAndZone_ZoneValueIsInheritedDownToVm()
        {
            this.project.Username = "******";

            zoneA.Username = "******";
            zoneB.Username = null;
            Assert.AreEqual("overriden-value", zoneA.Username);
            Assert.AreEqual("root-value", zoneB.Username);
            Assert.IsTrue(zoneA.ShouldSerializeUsername());
            Assert.IsFalse(zoneB.ShouldSerializeUsername());

            Assert.AreEqual("overriden-value", instanceA.Username);
            Assert.AreEqual("root-value", instanceB.Username);

            Assert.AreEqual("overriden-value", instanceA.CreateConnectionSettings("instance").Username);
            Assert.AreEqual("root-value", instanceB.CreateConnectionSettings("instance").Username);

            Assert.IsFalse(instanceA.ShouldSerializeUsername());
            Assert.IsFalse(instanceB.ShouldSerializeUsername());
        }