Example #1
0
        public void Equals_ShouldReturnFalseWhenOtherIsNull()
        {
            const ForwardedPortStatus other = null;

            var actual = ForwardedPortStatus.Stopped.Equals(other);

            Assert.IsFalse(actual);
        }
Example #2
0
        public void EqualityOperator_ShouldReturnFalseWhenRightIsNull()
        {
            var left = ForwardedPortStatus.Stopped;
            const ForwardedPortStatus right = null;

            var actual = left == right;

            Assert.IsFalse(actual);
        }
Example #3
0
        public void ToStarting_ShouldReturnTrueAndChangeStatusToStarting()
        {
            var status = ForwardedPortStatus.Stopped;

            var actual = ForwardedPortStatus.ToStarting(ref status);

            Assert.IsTrue(actual);
            Assert.AreEqual(ForwardedPortStatus.Starting, status);
        }
Example #4
0
        public void InEqualityOperator_ShouldReturnTrueWhenLeftIsNull()
        {
            const ForwardedPortStatus left = null;
            var right = ForwardedPortStatus.Stopped;

            var actual = left != right;

            Assert.IsTrue(actual);
        }
Example #5
0
        public void ToStopping_ShouldReturnFalseAndNotChangeStatus()
        {
            var status = ForwardedPortStatus.Stopped;

            var actual = ForwardedPortStatus.ToStopping(ref status);

            Assert.IsFalse(actual);
            Assert.AreEqual(ForwardedPortStatus.Stopped, status);
        }
Example #6
0
        public void InEqualityOperator_ShouldReturnTrueWhenRightIsNull()
        {
            var left = ForwardedPortStatus.Started;
            const ForwardedPortStatus right = null;

            var actual = left != right;

            Assert.IsTrue(actual);
        }
Example #7
0
        public void EqualityOperator_ShouldReturnFalseWhenLeftIsNull()
        {
            const ForwardedPortStatus left = null;
            var right = ForwardedPortStatus.Started;

            var actual = left == right;

            Assert.IsFalse(actual);
        }
Example #8
0
        public void ToStarting_ShouldThrowInvalidOperationExceptionAndNotChangeStatus()
        {
            var status = ForwardedPortStatus.Stopping;

            try
            {
                ForwardedPortStatus.ToStarting(ref status);
                Assert.Fail();
            }
            catch (InvalidOperationException ex)
            {
                Assert.IsNull(ex.InnerException);
                Assert.AreEqual(
                    string.Format("Forwarded port cannot transition from '{0}' to '{1}'.",
                                  ForwardedPortStatus.Stopping,
                                  ForwardedPortStatus.Starting),
                    ex.Message);
            }

            Assert.AreEqual(ForwardedPortStatus.Stopping, status);
        }