We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@{ foreach (var property in Class.Properties.Where(p => !p.IsIndexer && p.CanRead && p.CanWrite && p.Type.HasCommonValues)) { <text> @Tag("INotifyPropertyChanged") @TestAttribute public void @(Test.ClassName + "_Property_" + property.Name + "_NotifyPropertyChanged_SelfAssign") () { var objectUnderTest = CreateObject(); var events = new List<PropertyChangedEventArgs>(); ((INotifyPropertyChanged)objectUnderTest).PropertyChanged += (s, e) => events.Add(e); //Setting the value to the current value should always work and not raise any events var originalValue = [email protected]; [email protected] = originalValue; @Assert.IsTrue("events.Count() == 0", "\"No change events should have been raised, the property's value didn't change.\"") } </text> <text> @Tag("INotifyPropertyChanged") @TestAttribute public void @(Test.ClassName + "_Property_" + property.Name + "_NotifyPropertyChanged") () { var objectUnderTest = CreateObject(); var events = new List<PropertyChangedEventArgs>(); ((INotifyPropertyChanged)objectUnderTest).PropertyChanged += (s, e) => events.Add(e); //perform a self-assignment to avoid duplicating the above test var originalValue = [email protected]; [email protected] = originalValue; </text> foreach (var testValue in property.Type.CommonValues) { <text> events.Clear(); try { @property.Type.FullName expectedValue = @testValue; var valueChanged = !Object.Equals(expectedValue, [email protected]); [email protected] = expectedValue; if (valueChanged) @Assert.IsTrue("events.Any(e => e.PropertyName == \"" + property.Name + "\")", "\"No property changed event was raised for \\\"" + property.Name + "\\\".\"") else @Assert.IsTrue("events.Count() == 0", "\"No change events should have been raised, the property's value didn't change.\"") } catch (ArgumentException) { //OK return; } </text> } <text> } </text> } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: