Esempio n. 1
0
        public void should_run_bcd_edit_scripts_excluding_ntldr_call_when_windows_2008_r2()
        {
            var bcdDataStore = new Dictionary <string, string>
            {
                { SystemInformation.DRIVE_KEY, @"F:\" },
                { SystemInformation.UNIQUE_IDENTIFIER_KEY,
                  "{my unique identifier}" }
            };

            _exec.Stub(x => x.Enqueue(Arg <string> .Is.Anything, Arg <string> .Is.Anything)).Return(_exec);
            _exec.Stub(x => x.Enqueue(Arg <string> .Is.Anything, Arg <string> .Is.Anything, Arg <bool> .Is.Anything)).Return(_exec);
            _exec.Expect(x => x.Go()).Repeat.Once();
            _operatingSystemChecker.Stub(x => x.IsWindows2008).Return(true);
            _systemInformation.Stub(x => x.getDriveWithBootConfigurationDataStore())
            .Return(bcdDataStore);
            _systemInformation.Stub(x => x.getDriveLetterWithOriginalWindowsFolder()).Return("E:");


            new Unrescue(_exec, _operatingSystemChecker, _systemInformation).Execute(null);

            _exec.Replay();

            _exec.AssertWasCalled(x => x.Enqueue("bcdedit", @"/store F:\boot\bcd /set {my unique identifier} osdevice partition=E:"));
            _exec.AssertWasCalled(x => x.Enqueue("bcdedit", @"/store F:\boot\bcd /set {my unique identifier} device partition=E:"));
            _exec.AssertWasCalled(x => x.Enqueue("bcdedit", @"/store F:\boot\bcd /set {bootmgr} device partition=E:"));
            _exec.AssertWasCalled(x => x.Enqueue("bcdedit", @"/store F:\boot\bcd /set {memdiag} device partition=E:"));
            _exec.AssertWasCalled(x => x.Enqueue("bcdedit", @"/store F:\boot\bcd /set {ntldr} device partition=E:", false));
            _exec.AssertWasCalled(x => x.Go());
        }
        public void should_not_run_vbs_script_when_windows_2003()
        {
            exec = MockRepository.GenerateMock<IExecutableProcessQueue>();
            exec.Expect(x => x.Enqueue(Arg<string>.Is.Anything, Arg<string>.Is.Anything)).Repeat.Never();
            exec.Expect(x => x.Go()).Repeat.Never();
            _operatingSystemChecker = MockRepository.GenerateMock<IOperatingSystemChecker>();
            _operatingSystemChecker.Stub(x => x.IsWindows2008).Return(false);

            new ActivateWindowsUsingKms(exec, _operatingSystemChecker).Execute("server:port");

            exec.AssertWasNotCalled(x => x.Enqueue("cscript", "c:\\windows\\system32\\slmgr.vbs /skms " + "server:port"));
            exec.AssertWasNotCalled(x => x.Enqueue("cscript", "c:\\windows\\system32\\slmgr.vbs /ato"));
        }
Esempio n. 3
0
        public void should_not_run_vbs_script_when_windows_2003()
        {
            exec = MockRepository.GenerateMock <IExecutableProcessQueue>();
            exec.Expect(x => x.Enqueue(Arg <string> .Is.Anything, Arg <string> .Is.Anything)).Repeat.Never();
            exec.Expect(x => x.Go()).Repeat.Never();
            _operatingSystemChecker = MockRepository.GenerateMock <IOperatingSystemChecker>();
            _operatingSystemChecker.Stub(x => x.IsWindows2008).Return(false);

            new ActivateWindowsUsingKms(exec, _operatingSystemChecker).Execute("server:port");

            exec.AssertWasNotCalled(x => x.Enqueue("cscript", "c:\\windows\\system32\\slmgr.vbs /skms " + "server:port"));
            exec.AssertWasNotCalled(x => x.Enqueue("cscript", "c:\\windows\\system32\\slmgr.vbs /ato"));
        }