Esempio n. 1
0
        public void OnStartProgress()
        {
            var context = new Mock<IContextAware>();
            {
                context.Setup(c => c.IsSynchronized)
                    .Returns(true);
            }

            var collector = new Mock<ICollectProgressReports>();
            var model = new ProgressModel(context.Object, collector.Object);

            var propertyChangedWasRaised = 0;
            var properties = new List<string>();
            model.PropertyChanged += (s, e) =>
            {
                propertyChangedWasRaised++;
                properties.Add(e.PropertyName);
            };

            collector.Raise(c => c.OnStartProgress += null, EventArgs.Empty);

            Assert.AreEqual(0.0, model.Progress);
            Assert.AreEqual(3, propertyChangedWasRaised);
            Assert.That(
                properties,
                Is.EquivalentTo(
                    new List<string>
                    {
                        "Progress",
                        "Description",
                        "HasErrors"
                    }));
        }
Esempio n. 2
0
        public void OnStopProgress()
        {
            var context = new Mock <IContextAware>();
            {
                context.Setup(c => c.IsSynchronized)
                .Returns(true);
            }

            var collector = new Mock <ICollectProgressReports>();
            var model     = new ProgressModel(context.Object, collector.Object);

            var propertyChangedWasRaised = 0;
            var properties = new List <string>();

            model.PropertyChanged += (s, e) =>
            {
                propertyChangedWasRaised++;
                properties.Add(e.PropertyName);
            };

            collector.Raise(c => c.OnStopProgress += null, EventArgs.Empty);

            Assert.AreEqual(0.0, model.Progress);
            Assert.AreEqual(3, propertyChangedWasRaised);
            Assert.That(
                properties,
                Is.EquivalentTo(
                    new List <string>
            {
                "Progress",
                "Description",
                "HasErrors"
            }));
        }