public void ResourceModel_Commit_FixedErrorsNotRestored() { //Setup(); var eventPublisher = new EventPublisher(); var environmentModel = CreateMockEnvironment(eventPublisher); var instanceID = Guid.NewGuid(); var model = new ResourceModel(environmentModel.Object) { ID = instanceID }; var hitCount = 0; model.OnDesignValidationReceived += (sender, memo) => { switch (hitCount++) { case 0: Assert.AreEqual(2, model.Errors.Count); Assert.AreEqual(0, model.FixedErrors.Count); break; case 1: Assert.AreEqual(1, model.Errors.Count); Assert.AreEqual(1, model.FixedErrors.Count); model.Commit(); Assert.AreEqual(1, model.Errors.Count); Assert.AreEqual(0, model.FixedErrors.Count); break; default: break; } }; // Publish 2 errors var pubMemo = new DesignValidationMemo { InstanceID = instanceID }; pubMemo.Errors.Add(new ErrorInfo { ErrorType = ErrorType.Critical, Message = "Critical error.", InstanceID = instanceID }); pubMemo.Errors.Add(new ErrorInfo { ErrorType = ErrorType.Warning, Message = "Warning error.", InstanceID = instanceID }); eventPublisher.Publish(pubMemo); // Fix 1 error and publish pubMemo.Errors.RemoveAt(1); eventPublisher.Publish(pubMemo); }