コード例 #1
0
        public void DoPostImportUpdates_TargetIsObservable_NotifyObservers()
        {
            // Setup
            var mocks = new MockRepository();
            var observableInstance = mocks.Stub <IObservable>();

            observableInstance.Expect(o => o.NotifyObservers());
            mocks.ReplayAll();

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

            // Call
            simpleImporter.DoPostImport();

            // Assert
            mocks.VerifyAll(); // Assert NotifyObservers is called
        }
コード例 #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
        }