Exemplo n.º 1
0
        public void IndexTestWithReadyToInstallResult()
        {
            UpdateController target = null;
            // Arrange
            MockRepository mocks = new MockRepository();
            IUpdaterService updaterService = mocks.StrictMock<IUpdaterService>();
            ActionResult actual;

            using (mocks.Record())
            {
                Expect.Call(updaterService.GetInstallStatus(SymNetInfo.Instance)).Return(InstallStatus.ReadyToInstall);
            }

            try
            {
                target = new UpdateController(updaterService);
                using (mocks.Playback())
                {
                    actual = target.Index();
                }

            }
            finally
            {
                if (target != null)
                {
                    target.Dispose();
                }
            }

            ControllerTestHelper.TestForRedirection(actual, "Index", "Install", "Install");
        }
Exemplo n.º 2
0
        public void UpdateControllerConstructorTest()
        {
            // Arrange
            MockRepository mocks = new MockRepository();
            IUpdaterService updaterService = mocks.StrictMock<IUpdaterService>();
            using (mocks.Record())
            {

            }

            using (mocks.Playback())
            {
                UpdateController target = new UpdateController(updaterService);
                target.Dispose();
            }
        }
Exemplo n.º 3
0
        public void UpToDateTest()
        {
            UpdateController target = null;
            // Arrange
            MockRepository mocks = new MockRepository();
            IUpdaterService updaterService = mocks.StrictMock<IUpdaterService>();
            ActionResult actual;

            using (mocks.Record())
            {

            }

            try
            {
                target = new UpdateController(updaterService);
                using (mocks.Playback())
                {
                    actual = target.UpToDate();
                }

                ControllerTestHelper.TestForEmptyViewAndModel(actual, target);

            }
            finally
            {
                if (target != null)
                {
                    target.Dispose();
                }
            }
        }
Exemplo n.º 4
0
        public void IndexTestWithUpdateNeededResult()
        {
            UpdateController target = null;
            // Arrange
            MockRepository mocks = new MockRepository();
            IUpdaterService updaterService = mocks.StrictMock<IUpdaterService>();
            ActionResult actual;

            using (mocks.Record())
            {
                Expect.Call(updaterService.GetInstallStatus(SymNetInfo.Instance)).Return(InstallStatus.UpdateNeeded);
            }

            try
            {
                target = new UpdateController(updaterService);
                using (mocks.Playback())
                {
                    actual = target.Index();
                }

                Helpers.ControllerTestHelper.TestForEmptyViewAndModel(actual, target);
            }
            finally
            {
                if (target != null)
                {
                    target.Dispose();
                }
            }
        }