Пример #1
0
        public void NotifyProgress_DelegateSet_CallProgressChanged()
        {
            // Setup
            const string expectedDescription   = "B";
            const int    expectedStep          = 1;
            const int    expectedNumberOfSteps = 3;

            var importTarget             = new object();
            var simpleImporter           = new SimpleFileImporter <object>(importTarget);
            var progressChangedCallCount = 0;

            simpleImporter.SetProgressChanged((description, step, steps) =>
            {
                Assert.AreEqual(expectedDescription, description);
                Assert.AreEqual(expectedStep, step);
                Assert.AreEqual(expectedNumberOfSteps, steps);
                progressChangedCallCount++;
            });

            // Call
            simpleImporter.TestNotifyProgress(expectedDescription, expectedStep, expectedNumberOfSteps);

            // Assert
            Assert.AreEqual(1, progressChangedCallCount);
        }
Пример #2
0
        public void NotifyProgress_NoDelegateSet_DoNothing()
        {
            // Setup
            var importTarget   = new object();
            var simpleImporter = new SimpleFileImporter <object>(importTarget);

            simpleImporter.SetProgressChanged(null);

            // Call
            TestDelegate call = () => simpleImporter.TestNotifyProgress("A", 1, 2);

            // Assert
            Assert.DoesNotThrow(call);
        }