ClearErrors() public méthode

public ClearErrors ( ) : void
Résultat void
        public void ResourceModel_ClearErrors_ClearsErrors()
        {
            //------------Setup for test--------------------------
            var instanceID = Guid.NewGuid();

            var err1 = new Mock<IErrorInfo>();
            err1.Setup(e => e.InstanceID).Returns(instanceID);
            var err2 = new Mock<IErrorInfo>();
            err2.Setup(e => e.InstanceID).Returns(Guid.NewGuid());
            var model = new ResourceModel(new Mock<IEnvironmentModel>().Object, new Mock<IEventAggregator>().Object);
            model.AddError(err1.Object);
            model.AddError(err2.Object);

            var errorInfos = model.Errors;

            //------------Assert Preconditions-------------------------
            Assert.AreEqual(2, errorInfos.Count);
            //------------Execute Test---------------------------
            model.ClearErrors();
            //-------------Assert Results------------------------
            errorInfos = model.Errors;
            Assert.AreEqual(0, errorInfos.Count);
        }
        public void ResourceModel_ClearErrors_FiresPropertyChangeForErrors()
        {
            //------------Setup for test--------------------------
            var instanceID = Guid.NewGuid();

            var err1 = new Mock<IErrorInfo>();
            err1.Setup(e => e.InstanceID).Returns(instanceID);
            var err2 = new Mock<IErrorInfo>();
            err2.Setup(e => e.InstanceID).Returns(Guid.NewGuid());
            var model = new ResourceModel(new Mock<IEnvironmentModel>().Object, new Mock<IEventAggregator>().Object);
            model.AddError(err1.Object);
            model.AddError(err2.Object);
            var _propertyChangedFired = false;
            model.PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName == "Errors")
                {
                    _propertyChangedFired = true;
                }
            };
            //------------Execute Test---------------------------
            model.ClearErrors();
            //-------------Assert Results------------------------
            Assert.IsTrue(_propertyChangedFired);
        }