예제 #1
0
        public void GetInstallStatusTestWithNullSymNetInfo()
        {
            // Arrange
            MockRepository mocks = new MockRepository();
            ISymNetInfo symNetInfo = null;

            AbsInstallerService target = new AbsInstallerService(null);
            InstallStatus expected = InstallStatus.Unknown;
            InstallStatus actual;

            using (mocks.Record()) { /*nothing to record */  }

            using (mocks.Playback())
            {
                actual = target.GetInstallStatus(symNetInfo);
            }
            Assert.AreEqual(expected, actual);
        }
예제 #2
0
        public void GetInstallStatusTestWithBdVersionError()
        {
            // Arrange
            MockRepository mocks = new MockRepository();
            ISymNetInfo symNetInfo = mocks.StrictMock<ISymNetInfo>();
            ISymNetSettingContainer settingContainer = mocks.StrictMock<ISymNetSettingContainer>();
            AbsInstallerService target = new AbsInstallerService(settingContainer);
            InstallStatus expected = InstallStatus.Error;
            InstallStatus actual;

            using (mocks.Record())
            {
                Expect.Call(settingContainer.CurrentVersionFromDB).Throw(new Exception());
            }

            using (mocks.Playback())
            {
                actual = target.GetInstallStatus(symNetInfo);
            }
            Assert.AreEqual(expected, actual);
        }
예제 #3
0
        public void GetInstallStatusTestWithBdVersionOld()
        {
            // Arrange
            MockRepository mocks = new MockRepository();
            ISymNetInfo symNetInfo = mocks.StrictMock<ISymNetInfo>();
            ISymNetSettingContainer settingContainer = mocks.StrictMock<ISymNetSettingContainer>();
            AbsInstallerService target = new AbsInstallerService(settingContainer);
            InstallStatus expected = InstallStatus.UpdateNeeded;
            InstallStatus actual;

            using (mocks.Record())
            {
                Expect.Call(settingContainer.CurrentVersionFromDB).Return(new Version(1, 0, 1, 0));
                Expect.Call(symNetInfo.Version).Return(new Version(1,0,2,0));
            }

            using (mocks.Playback())
            {
                actual = target.GetInstallStatus(symNetInfo);
            }
            Assert.AreEqual(expected, actual);
        }