Exemple #1
0
            bool GetIsEnabled(BaseWpfFixture fixture)
            {
                if (failedCount > 42)
                {
                    return(false);
                }
                BindingErrorsDetectionAttribute bindingErrorsDetectionAttribute = TypeDescriptor.GetAttributes(fixture)[typeof(BindingErrorsDetectionAttribute)] as BindingErrorsDetectionAttribute;

                if (bindingErrorsDetectionAttribute == null || !bindingErrorsDetectionAttribute.IsBindingErrorsDetectionEnabled)
                {
                    return(false);
                }
                return(true);
            }
Exemple #2
0
 public void Report(BaseWpfFixture fixture)
 {
     if (!isEnabled)
     {
         return;
     }
     Flush();
     if (builder.Length > 0)
     {
         failedCount++;
         builder.Insert(0, "Binding errors occured while testing: \r\n");
         Assert.Fail(builder.ToString());
     }
     isEnabled = false;
     PresentationTraceSources.DataBindingSource.Listeners.Remove(BindingErrorsTraceListener.Intance);
     PresentationTraceSources.DataBindingSource.Switch.Level = oldLevel;
 }
Exemple #3
0
            public void Reset(BaseWpfFixture fixture, bool?enable = null)
            {
                builder.Clear();
                Assembly currentAssembly = fixture.GetType().Assembly;

                if (lastAssembly != currentAssembly)
                {
                    failedCount  = 0;
                    lastAssembly = currentAssembly;
                }
                SetEnabled(enable ?? GetIsEnabled(fixture));
                if (isEnabled)
                {
                    oldLevel = PresentationTraceSources.DataBindingSource.Switch.Level;
                    PresentationTraceSources.Refresh();
                    PresentationTraceSources.DataBindingSource.Listeners.Add(BindingErrorsTraceListener.Intance);
                    PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Error;
                }
            }