Renci.SshNet.Tests.ForwardedPortStatusTest_Stopping.ToStarting_ShouldThrowInvalidOperationExceptionAndNotChangeStatus C# (CSharp) Method

ToStarting_ShouldThrowInvalidOperationExceptionAndNotChangeStatus() private method

        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);
        }