示例#1
0
        public void Import_CancelGivesUnsuccessfulImport_CallsLogImportCanceledMessage()
        {
            //  Setup
            var importTarget   = new object();
            var simpleImporter = new SimpleFileImporter <object>(importTarget)
            {
                ImportSuccessful = false
            };

            simpleImporter.SetProgressChanged((description, step, steps) => simpleImporter.Cancel());

            // Call
            simpleImporter.Import();

            // Assert
            Assert.IsTrue(simpleImporter.LogCanceledMessageCalled);
        }
示例#2
0
        public void DoPostImportUpdates_ImportCanceled_NoNotifyObserversCalled()
        {
            // Setup
            var mocks            = new MockRepository();
            var observableTarget = mocks.StrictMock <IObservable>();

            mocks.ReplayAll();

            var simpleImporter = new SimpleFileImporter <IObservable>(observableTarget);

            simpleImporter.Cancel();

            // Call
            simpleImporter.DoPostImport();

            // Assert
            mocks.VerifyAll(); // Assert no NotifyObservers were called
        }
示例#3
0
        public void Import_CancelGivesSuccessfulImport_LogsMessage()
        {
            //  Setup
            var importTarget   = new object();
            var simpleImporter = new SimpleFileImporter <object>(importTarget)
            {
                ImportSuccessful = true
            };

            simpleImporter.SetProgressChanged((description, step, steps) => simpleImporter.Cancel());

            // Call
            Action call = () => simpleImporter.Import();

            // Assert
            TestHelper.AssertLogMessageWithLevelIsGenerated(call, new Tuple <string, LogLevelConstant>(
                                                                "Huidige actie was niet meer te annuleren en is daarom voortgezet.",
                                                                LogLevelConstant.Warn));
        }