コード例 #1
0
        public void Opening_project_should_report_any_errors_that_occur()
        {
            var exception = new Exception();

            testProjectManager.Stub(tpm => tpm.LoadProject(Arg <FileInfo> .Is.Anything)).Throw(exception);

            projectController.OpenProject(MockProgressMonitor.Instance, Path.GetFullPath("projectName"));

            unhandledExceptionPolicy.AssertWasCalled(uep => uep.Report(Arg.Is(Resources.ProjectController_Error_loading_project_file),
                                                                       Arg.Is(exception)));
        }
コード例 #2
0
        public void SaveProject_with_false_and_execute_exception_should_report_error()
        {
            string projectName = Paths.DefaultProject;

            commandFactory.Stub(cf => cf.CreateSaveProjectCommand(projectName)).Return(command);
            var exception = new Exception();

            command.Stub(c => c.Execute(NullProgressMonitor.CreateInstance())).IgnoreArguments().Throw(exception);

            applicationController.SaveProject(false);

            commandFactory.AssertWasCalled(cf => cf.CreateSaveProjectCommand(projectName));
            unhandledExceptionPolicy.AssertWasCalled(uep => uep.Report("Error saving project", exception));
        }
コード例 #3
0
        public void Errors_logged_when_loading_user_options()
        {
            fileSystem.Stub(fs => fs.FileExists(Arg <string> .Is.Anything))
            .Return(true);
            var exception = new Exception();

            xmlSerializer.Stub(xs => xs.LoadFromXml <UserOptions>(Arg <string> .Is.Anything))
            .Throw(exception);

            controller.Handle(new ProjectLoaded("test.gallio"));

            unhandledExceptionPolicy.AssertWasCalled(uep =>
                                                     uep.Report(Resources.UserOptionsController_Failed_to_load_user_options_, exception));
        }