diff --git a/PropertyChanged.Fody.Analyzer.Tests/CodeGeneratorTest.cs b/PropertyChanged.Fody.Analyzer.Tests/CodeGeneratorTest.cs index e1879a89..87af2af0 100644 --- a/PropertyChanged.Fody.Analyzer.Tests/CodeGeneratorTest.cs +++ b/PropertyChanged.Fody.Analyzer.Tests/CodeGeneratorTest.cs @@ -500,29 +500,31 @@ public partial class Class2a : INotifyPropertyChanged [Fact] public async Task CodeIsGeneratedForNestedPartialClasses() { - var source = @" -using System.ComponentModel; -using PropertyChanged; + var source = """ -[AddINotifyPropertyChangedInterface] -public partial class Class1 -{ - public int Property1 { get; set; } - public int Property2 { get; set; } + using System.ComponentModel; + using PropertyChanged; - public partial class Class2 - { - public int Property1 { get; set; } - public int Property2 { get; set; } + [AddINotifyPropertyChangedInterface] + public partial class Class1 + { + public int Property1 { get; set; } + public int Property2 { get; set; } + + public partial class Class2 + { + public int Property1 { get; set; } + public int Property2 { get; set; } + + public partial class Class3 : INotifyPropertyChanged + { + public int Property1 { get; set; } + public int Property2 { get; set; } + } + } + } - public partial class Class3 : INotifyPropertyChanged - { - public int Property1 { get; set; } - public int Property2 { get; set; } - } - } -} -"; + """; var generated = await new Test(source).RunAsync(); await Verify(generated); diff --git a/PropertyChanged.Fody/OnChangedWalker.cs b/PropertyChanged.Fody/OnChangedWalker.cs index 6fda0ea9..14319ec5 100644 --- a/PropertyChanged.Fody/OnChangedWalker.cs +++ b/PropertyChanged.Fody/OnChangedWalker.cs @@ -232,8 +232,7 @@ bool PropertyWillBeNotified(PropertyDefinition p) } } - - string GetMethodWarning(TypeNode notifyNode, OnChangedMethod onChangedMethod) + static string GetMethodWarning(TypeNode notifyNode, OnChangedMethod onChangedMethod) { var method = onChangedMethod.MethodDefinition; var methodRef = onChangedMethod.MethodReference; diff --git a/PropertyChanged.Fody/PropertyDataWalker.cs b/PropertyChanged.Fody/PropertyDataWalker.cs index a8084b56..5dadf37d 100644 --- a/PropertyChanged.Fody/PropertyDataWalker.cs +++ b/PropertyChanged.Fody/PropertyDataWalker.cs @@ -88,7 +88,7 @@ void GetPropertyData(PropertyDefinition propertyDefinition, TypeNode node) }); } - List GetFullDependencies(PropertyDefinition propertyDefinition, IEnumerable dependenciesForProperty, TypeNode node) + static List GetFullDependencies(PropertyDefinition propertyDefinition, IEnumerable dependenciesForProperty, TypeNode node) { // Create an HashSet to contain all dependent properties (direct or transitive) // Add the initial Property to stop the recursion if this property is a dependency of another property diff --git a/PropertyChanged.Fody/SupportsCeqChecker.cs b/PropertyChanged.Fody/SupportsCeqChecker.cs index c556a1a6..2dcbc5c7 100644 --- a/PropertyChanged.Fody/SupportsCeqChecker.cs +++ b/PropertyChanged.Fody/SupportsCeqChecker.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Generic; using Mono.Cecil; @@ -10,19 +9,19 @@ static SupportsCeqChecker() { ceqStructNames = new() { - typeof (int).Name, - typeof (uint).Name, - typeof (long).Name, - typeof (ulong).Name, - typeof (float).Name, - typeof (double).Name, - typeof (bool).Name, - typeof (short).Name, - typeof (ushort).Name, - typeof (byte).Name, - typeof (sbyte).Name, - typeof (char).Name, - }; + typeof(int).Name, + typeof(uint).Name, + typeof(long).Name, + typeof(ulong).Name, + typeof(float).Name, + typeof(double).Name, + typeof(bool).Name, + typeof(short).Name, + typeof(ushort).Name, + typeof(byte).Name, + typeof(sbyte).Name, + typeof(char).Name, + }; } public static bool SupportsCeq(this TypeReference typeReference) @@ -31,23 +30,28 @@ public static bool SupportsCeq(this TypeReference typeReference) { return true; } + if (typeReference.IsArray) { return false; } + if (typeReference.ContainsGenericParameter) { return false; } + var typeDefinition = typeReference.Resolve(); if (typeDefinition == null) { throw new($"Could not resolve '{typeReference.FullName}'."); } + if (typeDefinition.IsEnum) { return true; } + return !typeDefinition.IsValueType; } } \ No newline at end of file diff --git a/PropertyChanged.Fody/TypeNode.cs b/PropertyChanged.Fody/TypeNode.cs index d57ae161..530aa1f9 100644 --- a/PropertyChanged.Fody/TypeNode.cs +++ b/PropertyChanged.Fody/TypeNode.cs @@ -4,21 +4,13 @@ public class TypeNode { - public TypeNode() - { - Nodes = new(); - PropertyDependencies = new List(); - Mappings = new List(); - PropertyDatas = new List(); - } - public TypeDefinition TypeDefinition; - public List Nodes; - public List PropertyDependencies; - public List Mappings; + public List Nodes = new(); + public List PropertyDependencies = new(); + public List Mappings = new(); public EventInvokerMethod EventInvoker; public MethodReference IsChangedInvoker; - public List PropertyDatas; + public List PropertyDatas = new(); public List AllProperties; public ICollection OnChangedMethods; public IEnumerable DeclaredProperties => AllProperties.Where(prop => prop.DeclaringType == TypeDefinition); diff --git a/TestAssemblies/AssemblyToProcess/ClassWithBeforeAfterImplementation.cs b/TestAssemblies/AssemblyToProcess/ClassWithBeforeAfterImplementation.cs index 80d6363a..2fe9c0ba 100644 --- a/TestAssemblies/AssemblyToProcess/ClassWithBeforeAfterImplementation.cs +++ b/TestAssemblies/AssemblyToProcess/ClassWithBeforeAfterImplementation.cs @@ -1,5 +1,4 @@ -using System; -using System.ComponentModel; +using System.ComponentModel; using PropertyChanged; public class ClassWithBeforeAfterImplementation : diff --git a/TestAssemblies/AssemblyToProcess/ClassWithOnChangedBeforeAfterGeneric.cs b/TestAssemblies/AssemblyToProcess/ClassWithOnChangedBeforeAfterGeneric.cs index bf2043b2..1d02217a 100644 --- a/TestAssemblies/AssemblyToProcess/ClassWithOnChangedBeforeAfterGeneric.cs +++ b/TestAssemblies/AssemblyToProcess/ClassWithOnChangedBeforeAfterGeneric.cs @@ -10,7 +10,7 @@ public class ClassWithOnChangedBeforeAfterGeneric : public void OnPropertyChanged(string propertyName, T before, T after) { GenericOnPropertyChangedCalled = true; - PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + PropertyChanged(this, new(propertyName)); } public event PropertyChangedEventHandler PropertyChanged; diff --git a/TestAssemblies/AssemblyToProcess/ClassWithOnChangedBeforeAfterTyped.cs b/TestAssemblies/AssemblyToProcess/ClassWithOnChangedBeforeAfterTyped.cs index ed1e2826..1f2f18a0 100644 --- a/TestAssemblies/AssemblyToProcess/ClassWithOnChangedBeforeAfterTyped.cs +++ b/TestAssemblies/AssemblyToProcess/ClassWithOnChangedBeforeAfterTyped.cs @@ -108,10 +108,6 @@ public void OnProperty1Changed(T before, T after) public event PropertyChangedEventHandler PropertyChanged; } -public class ClassWithOnChangedBeforeAfterTypedGenericString : ClassWithOnChangedBeforeAfterTypedGeneric -{ -} +public class ClassWithOnChangedBeforeAfterTypedGenericString : ClassWithOnChangedBeforeAfterTypedGeneric; -public class ClassWithOnChangedBeforeAfterTypedGenericInteger : ClassWithOnChangedBeforeAfterTypedGeneric -{ -} +public class ClassWithOnChangedBeforeAfterTypedGenericInteger : ClassWithOnChangedBeforeAfterTypedGeneric; diff --git a/TestAssemblies/AssemblyToProcess/ClassWithOnChangedCalculatedProperty.cs b/TestAssemblies/AssemblyToProcess/ClassWithOnChangedCalculatedProperty.cs index 683f0f34..0faba0fe 100644 --- a/TestAssemblies/AssemblyToProcess/ClassWithOnChangedCalculatedProperty.cs +++ b/TestAssemblies/AssemblyToProcess/ClassWithOnChangedCalculatedProperty.cs @@ -9,7 +9,7 @@ public class ClassWithOnChangedCalculatedProperty : public string Property1 { get; set; } public string Property2 => $"{Property1}!"; public string Property3 => $"{Property2}!"; - + public void OnProperty2Changed() { OnProperty2ChangedCalled = true; diff --git a/TestAssemblies/AssemblyToProcess/ClassWithOwnImplementation.cs b/TestAssemblies/AssemblyToProcess/ClassWithOwnImplementation.cs index 84208140..08a07a56 100644 --- a/TestAssemblies/AssemblyToProcess/ClassWithOwnImplementation.cs +++ b/TestAssemblies/AssemblyToProcess/ClassWithOwnImplementation.cs @@ -11,6 +11,6 @@ public class ClassWithOwnImplementation : public virtual void OnPropertyChanged(string propertyName) { BaseNotifyCalled = true; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + PropertyChanged?.Invoke(this, new(propertyName)); } } \ No newline at end of file diff --git a/TestAssemblies/AssemblyToProcess/ComplexHierarchy/ClassChild1.cs b/TestAssemblies/AssemblyToProcess/ComplexHierarchy/ClassChild1.cs index edf0b0e3..e3db5460 100644 --- a/TestAssemblies/AssemblyToProcess/ComplexHierarchy/ClassChild1.cs +++ b/TestAssemblies/AssemblyToProcess/ComplexHierarchy/ClassChild1.cs @@ -1,7 +1,6 @@ -namespace ComplexHierarchy +namespace ComplexHierarchy; + +public class ClassChild1 : ClassParent { - public class ClassChild1 : ClassParent - { - public string Property1 { get; set; } - } + public string Property1 { get; set; } } \ No newline at end of file diff --git a/TestAssemblies/AssemblyToProcess/ComplexHierarchy/ClassChild2.cs b/TestAssemblies/AssemblyToProcess/ComplexHierarchy/ClassChild2.cs index 8d242414..476ef94e 100644 --- a/TestAssemblies/AssemblyToProcess/ComplexHierarchy/ClassChild2.cs +++ b/TestAssemblies/AssemblyToProcess/ComplexHierarchy/ClassChild2.cs @@ -1,7 +1,6 @@ -namespace ComplexHierarchy +namespace ComplexHierarchy; + +public class ClassChild2 : ClassParent { - public class ClassChild2 : ClassParent - { - public string Property1 { get; set; } - } + public string Property1 { get; set; } } \ No newline at end of file diff --git a/TestAssemblies/AssemblyToProcess/ComplexHierarchy/ClassChild3.cs b/TestAssemblies/AssemblyToProcess/ComplexHierarchy/ClassChild3.cs index 65fcedbd..785c9c8c 100644 --- a/TestAssemblies/AssemblyToProcess/ComplexHierarchy/ClassChild3.cs +++ b/TestAssemblies/AssemblyToProcess/ComplexHierarchy/ClassChild3.cs @@ -1,8 +1,6 @@ - -namespace ComplexHierarchy +namespace ComplexHierarchy; + +public class ClassChild3 : ClassChild2 { - public class ClassChild3 : ClassChild2 - { - public string Property2 { get; set; } - } + public string Property2 { get; set; } } \ No newline at end of file diff --git a/TestAssemblies/AssemblyToProcess/ComplexHierarchy/ClassParent.cs b/TestAssemblies/AssemblyToProcess/ComplexHierarchy/ClassParent.cs index 41e21dac..ddba6ab1 100644 --- a/TestAssemblies/AssemblyToProcess/ComplexHierarchy/ClassParent.cs +++ b/TestAssemblies/AssemblyToProcess/ComplexHierarchy/ClassParent.cs @@ -1,9 +1,8 @@ using System.ComponentModel; -namespace ComplexHierarchy +namespace ComplexHierarchy; + +public class ClassParent: INotifyPropertyChanged { - public class ClassParent: INotifyPropertyChanged - { - public event PropertyChangedEventHandler PropertyChanged; - } + public event PropertyChangedEventHandler PropertyChanged; } \ No newline at end of file diff --git a/TestAssemblies/AssemblyToProcess/FieldsFromOtherClass/ClassWithFieldFromOtherClass.cs b/TestAssemblies/AssemblyToProcess/FieldsFromOtherClass/ClassWithFieldFromOtherClass.cs index 12adfe7b..d5998172 100644 --- a/TestAssemblies/AssemblyToProcess/FieldsFromOtherClass/ClassWithFieldFromOtherClass.cs +++ b/TestAssemblies/AssemblyToProcess/FieldsFromOtherClass/ClassWithFieldFromOtherClass.cs @@ -3,12 +3,7 @@ public class ClassWithFieldFromOtherClass : INotifyPropertyChanged { - OtherClass otherClass; - - public ClassWithFieldFromOtherClass() - { - otherClass = new OtherClass(); - } + OtherClass otherClass = new(); public string Property1 { diff --git a/TestAssemblies/AssemblyToProcess/GenericBase/ClassWithGenericChild.cs b/TestAssemblies/AssemblyToProcess/GenericBase/ClassWithGenericChild.cs index 719919d7..79a06b95 100644 --- a/TestAssemblies/AssemblyToProcess/GenericBase/ClassWithGenericChild.cs +++ b/TestAssemblies/AssemblyToProcess/GenericBase/ClassWithGenericChild.cs @@ -1,3 +1 @@ -public class ClassWithGenericChild : ClassWithGenericParent -{ -} \ No newline at end of file +public class ClassWithGenericChild : ClassWithGenericParent; \ No newline at end of file diff --git a/TestAssemblies/AssemblyToProcess/GenericBaseWithProperty/ClassWithGenericProperty.cs b/TestAssemblies/AssemblyToProcess/GenericBaseWithProperty/ClassWithGenericProperty.cs index 8ea5d341..9b713ab8 100644 --- a/TestAssemblies/AssemblyToProcess/GenericBaseWithProperty/ClassWithGenericProperty.cs +++ b/TestAssemblies/AssemblyToProcess/GenericBaseWithProperty/ClassWithGenericProperty.cs @@ -1,10 +1,9 @@ using System.ComponentModel; -namespace GenericBaseWithProperty -{ - public class ClassWithGenericPropertyParent : +namespace GenericBaseWithProperty; + +public class ClassWithGenericPropertyParent : INotifyPropertyChanged { - public T Property1 { get; set; } - public event PropertyChangedEventHandler PropertyChanged; - } + public T Property1 { get; set; } + public event PropertyChangedEventHandler PropertyChanged; } \ No newline at end of file diff --git a/TestAssemblies/AssemblyToProcess/GenericBaseWithProperty/ClassWithGenericPropertyChild.cs b/TestAssemblies/AssemblyToProcess/GenericBaseWithProperty/ClassWithGenericPropertyChild.cs index 9a0b68cf..b258ed40 100644 --- a/TestAssemblies/AssemblyToProcess/GenericBaseWithProperty/ClassWithGenericPropertyChild.cs +++ b/TestAssemblies/AssemblyToProcess/GenericBaseWithProperty/ClassWithGenericPropertyChild.cs @@ -1,10 +1,5 @@ -namespace GenericBaseWithProperty -{ - public class ClassWithGenericPropertyChild : ClassWithGenericPropertyParent - { - } +namespace GenericBaseWithProperty; - public class ClassWithGenericPropertyDouble : ClassWithGenericPropertyParent - { - } -} \ No newline at end of file +public class ClassWithGenericPropertyChild : ClassWithGenericPropertyParent; + +public class ClassWithGenericPropertyDouble : ClassWithGenericPropertyParent; \ No newline at end of file diff --git a/TestAssemblies/AssemblyToProcess/GenericBaseWithPropertyBeforeAfter/ClassWithGenericProperty.cs b/TestAssemblies/AssemblyToProcess/GenericBaseWithPropertyBeforeAfter/ClassWithGenericProperty.cs index 0bf24fa2..b3b90cca 100644 --- a/TestAssemblies/AssemblyToProcess/GenericBaseWithPropertyBeforeAfter/ClassWithGenericProperty.cs +++ b/TestAssemblies/AssemblyToProcess/GenericBaseWithPropertyBeforeAfter/ClassWithGenericProperty.cs @@ -1,14 +1,13 @@ using System.ComponentModel; -namespace GenericBaseWithPropertyBeforeAfter -{ - public class ClassWithGenericPropertyParent : +namespace GenericBaseWithPropertyBeforeAfter; + +public class ClassWithGenericPropertyParent : INotifyPropertyChanged { - public T Property1 { get; set; } - public event PropertyChangedEventHandler PropertyChanged; - public void OnPropertyChanged(string propertyName, object before, object after) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + public T Property1 { get; set; } + public event PropertyChangedEventHandler PropertyChanged; + public void OnPropertyChanged(string propertyName, object before, object after) + { + PropertyChanged?.Invoke(this, new(propertyName)); } } \ No newline at end of file diff --git a/TestAssemblies/AssemblyToProcess/GenericBaseWithPropertyBeforeAfter/ClassWithGenericPropertyChild.cs b/TestAssemblies/AssemblyToProcess/GenericBaseWithPropertyBeforeAfter/ClassWithGenericPropertyChild.cs index daaf7f5c..14a98666 100644 --- a/TestAssemblies/AssemblyToProcess/GenericBaseWithPropertyBeforeAfter/ClassWithGenericPropertyChild.cs +++ b/TestAssemblies/AssemblyToProcess/GenericBaseWithPropertyBeforeAfter/ClassWithGenericPropertyChild.cs @@ -1,6 +1,3 @@ -namespace GenericBaseWithPropertyBeforeAfter -{ - public class ClassWithGenericPropertyChild : ClassWithGenericPropertyParent - { - } -} \ No newline at end of file +namespace GenericBaseWithPropertyBeforeAfter; + +public class ClassWithGenericPropertyChild : ClassWithGenericPropertyParent; \ No newline at end of file diff --git a/TestAssemblies/AssemblyToProcess/GenericBaseWithPropertyOnChanged/ClassWithGenericProperty.cs b/TestAssemblies/AssemblyToProcess/GenericBaseWithPropertyOnChanged/ClassWithGenericProperty.cs index d7a8fadc..b2bef764 100644 --- a/TestAssemblies/AssemblyToProcess/GenericBaseWithPropertyOnChanged/ClassWithGenericProperty.cs +++ b/TestAssemblies/AssemblyToProcess/GenericBaseWithPropertyOnChanged/ClassWithGenericProperty.cs @@ -1,24 +1,23 @@ using System.ComponentModel; -namespace GenericBaseWithPropertyOnChanged -{ - public class ClassWithGenericPropertyParent : - INotifyPropertyChanged { - public bool OnProperty1ChangedCalled; - public bool OnProperty2ChangedCalled; +namespace GenericBaseWithPropertyOnChanged; - public T Property1 { get; set; } - public void OnProperty1Changed() - { - OnProperty1ChangedCalled = true; - } +public class ClassWithGenericPropertyParent : + INotifyPropertyChanged { + public bool OnProperty1ChangedCalled; + public bool OnProperty2ChangedCalled; - public T Property2 { get; set; } - public void OnProperty2Changed() - { - OnProperty2ChangedCalled = true; - } + public T Property1 { get; set; } + public void OnProperty1Changed() + { + OnProperty1ChangedCalled = true; + } - public event PropertyChangedEventHandler PropertyChanged; + public T Property2 { get; set; } + public void OnProperty2Changed() + { + OnProperty2ChangedCalled = true; } + + public event PropertyChangedEventHandler PropertyChanged; } \ No newline at end of file diff --git a/TestAssemblies/AssemblyToProcess/GenericBaseWithPropertyOnChanged/ClassWithGenericPropertyChild.cs b/TestAssemblies/AssemblyToProcess/GenericBaseWithPropertyOnChanged/ClassWithGenericPropertyChild.cs index b203203d..075e6f50 100644 --- a/TestAssemblies/AssemblyToProcess/GenericBaseWithPropertyOnChanged/ClassWithGenericPropertyChild.cs +++ b/TestAssemblies/AssemblyToProcess/GenericBaseWithPropertyOnChanged/ClassWithGenericPropertyChild.cs @@ -1,6 +1,3 @@ -namespace GenericBaseWithPropertyOnChanged -{ - public class ClassWithGenericPropertyChild : ClassWithGenericPropertyParent - { - } -} \ No newline at end of file +namespace GenericBaseWithPropertyOnChanged; + +public class ClassWithGenericPropertyChild : ClassWithGenericPropertyParent; \ No newline at end of file diff --git a/TestAssemblies/AssemblyToProcess/GenericChildWithProperty/ClassWithGenericProperty.cs b/TestAssemblies/AssemblyToProcess/GenericChildWithProperty/ClassWithGenericProperty.cs index 8e21258a..dbb95d13 100644 --- a/TestAssemblies/AssemblyToProcess/GenericChildWithProperty/ClassWithGenericProperty.cs +++ b/TestAssemblies/AssemblyToProcess/GenericChildWithProperty/ClassWithGenericProperty.cs @@ -1,9 +1,9 @@ using System.ComponentModel; -namespace GenericChildWithProperty +namespace GenericChildWithProperty; + +public class ClassWithGenericPropertyParent : + INotifyPropertyChanged { - public class ClassWithGenericPropertyParent : - INotifyPropertyChanged { - public event PropertyChangedEventHandler PropertyChanged; - } + public event PropertyChangedEventHandler PropertyChanged; } \ No newline at end of file diff --git a/TestAssemblies/AssemblyToProcess/GenericChildWithProperty/ClassWithGenericPropertyChild.cs b/TestAssemblies/AssemblyToProcess/GenericChildWithProperty/ClassWithGenericPropertyChild.cs index 92cdd704..9b5b81c1 100644 --- a/TestAssemblies/AssemblyToProcess/GenericChildWithProperty/ClassWithGenericPropertyChild.cs +++ b/TestAssemblies/AssemblyToProcess/GenericChildWithProperty/ClassWithGenericPropertyChild.cs @@ -1,7 +1,6 @@ -namespace GenericChildWithProperty +namespace GenericChildWithProperty; + +public class ClassWithGenericPropertyChild : ClassWithGenericPropertyParent { - public class ClassWithGenericPropertyChild : ClassWithGenericPropertyParent - { - public string Property1 { get; set; } - } + public string Property1 { get; set; } } \ No newline at end of file diff --git a/TestAssemblies/AssemblyToProcess/GenericChildWithPropertyBeforeAfter/ClassWithGenericProperty.cs b/TestAssemblies/AssemblyToProcess/GenericChildWithPropertyBeforeAfter/ClassWithGenericProperty.cs index d384f659..2bcffec5 100644 --- a/TestAssemblies/AssemblyToProcess/GenericChildWithPropertyBeforeAfter/ClassWithGenericProperty.cs +++ b/TestAssemblies/AssemblyToProcess/GenericChildWithPropertyBeforeAfter/ClassWithGenericProperty.cs @@ -1,13 +1,12 @@ using System.ComponentModel; -namespace GenericChildWithPropertyBeforeAfter -{ - public class ClassWithGenericPropertyParent : +namespace GenericChildWithPropertyBeforeAfter; + +public class ClassWithGenericPropertyParent : INotifyPropertyChanged { - public event PropertyChangedEventHandler PropertyChanged; - public void OnPropertyChanged(string propertyName, object before, object after) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + public event PropertyChangedEventHandler PropertyChanged; + public void OnPropertyChanged(string propertyName, object before, object after) + { + PropertyChanged?.Invoke(this, new(propertyName)); } } \ No newline at end of file diff --git a/TestAssemblies/AssemblyToProcess/GenericChildWithPropertyBeforeAfter/ClassWithGenericPropertyChild.cs b/TestAssemblies/AssemblyToProcess/GenericChildWithPropertyBeforeAfter/ClassWithGenericPropertyChild.cs index 938892a1..4efd7df5 100644 --- a/TestAssemblies/AssemblyToProcess/GenericChildWithPropertyBeforeAfter/ClassWithGenericPropertyChild.cs +++ b/TestAssemblies/AssemblyToProcess/GenericChildWithPropertyBeforeAfter/ClassWithGenericPropertyChild.cs @@ -1,7 +1,6 @@ -namespace GenericChildWithPropertyBeforeAfter +namespace GenericChildWithPropertyBeforeAfter; + +public class ClassWithGenericPropertyChild : ClassWithGenericPropertyParent { - public class ClassWithGenericPropertyChild : ClassWithGenericPropertyParent - { - public string Property1 { get; set; } - } + public string Property1 { get; set; } } \ No newline at end of file diff --git a/TestAssemblies/AssemblyToProcess/GenericChildWithPropertyOnChanged/ClassWithGenericProperty.cs b/TestAssemblies/AssemblyToProcess/GenericChildWithPropertyOnChanged/ClassWithGenericProperty.cs index 8b0398ed..33dfa03f 100644 --- a/TestAssemblies/AssemblyToProcess/GenericChildWithPropertyOnChanged/ClassWithGenericProperty.cs +++ b/TestAssemblies/AssemblyToProcess/GenericChildWithPropertyOnChanged/ClassWithGenericProperty.cs @@ -1,9 +1,8 @@ using System.ComponentModel; -namespace GenericChildWithPropertyOnChanged -{ - public class ClassWithGenericPropertyParent : +namespace GenericChildWithPropertyOnChanged; + +public class ClassWithGenericPropertyParent : INotifyPropertyChanged { - public event PropertyChangedEventHandler PropertyChanged; - } + public event PropertyChangedEventHandler PropertyChanged; } \ No newline at end of file diff --git a/TestAssemblies/AssemblyToProcess/GenericChildWithPropertyOnChanged/ClassWithGenericPropertyChild.cs b/TestAssemblies/AssemblyToProcess/GenericChildWithPropertyOnChanged/ClassWithGenericPropertyChild.cs index d90b41ba..cc601709 100644 --- a/TestAssemblies/AssemblyToProcess/GenericChildWithPropertyOnChanged/ClassWithGenericPropertyChild.cs +++ b/TestAssemblies/AssemblyToProcess/GenericChildWithPropertyOnChanged/ClassWithGenericPropertyChild.cs @@ -1,21 +1,20 @@ -namespace GenericChildWithPropertyOnChanged +namespace GenericChildWithPropertyOnChanged; + +public class ClassWithGenericPropertyChild : ClassWithGenericPropertyParent { - public class ClassWithGenericPropertyChild : ClassWithGenericPropertyParent - { - public bool OnProperty1ChangedCalled; + public bool OnProperty1ChangedCalled; - public string Property1 { get; set; } - public void OnProperty1Changed() - { - OnProperty1ChangedCalled = true; - } + public string Property1 { get; set; } + public void OnProperty1Changed() + { + OnProperty1ChangedCalled = true; + } - public bool OnProperty2ChangedCalled; + public bool OnProperty2ChangedCalled; - public string Property2 { get; set; } - public void OnProperty2Changed() - { - OnProperty2ChangedCalled = true; - } + public string Property2 { get; set; } + public void OnProperty2Changed() + { + OnProperty2ChangedCalled = true; } } \ No newline at end of file diff --git a/TestAssemblies/AssemblyToProcess/GenericMiddle/ClassWithGenericMiddleBase.cs b/TestAssemblies/AssemblyToProcess/GenericMiddle/ClassWithGenericMiddleBase.cs index 9c01aa81..665f7a93 100644 --- a/TestAssemblies/AssemblyToProcess/GenericMiddle/ClassWithGenericMiddleBase.cs +++ b/TestAssemblies/AssemblyToProcess/GenericMiddle/ClassWithGenericMiddleBase.cs @@ -3,6 +3,6 @@ public class ClassWithGenericMiddleBase : INotifyPropertyChanged { public string Property1 { get; set; } - + public event PropertyChangedEventHandler PropertyChanged; } diff --git a/TestAssemblies/AssemblyToProcess/HierarchyBeforeAfterAndSimple/ClassBase.cs b/TestAssemblies/AssemblyToProcess/HierarchyBeforeAfterAndSimple/ClassBase.cs index c637471d..8b270c13 100644 --- a/TestAssemblies/AssemblyToProcess/HierarchyBeforeAfterAndSimple/ClassBase.cs +++ b/TestAssemblies/AssemblyToProcess/HierarchyBeforeAfterAndSimple/ClassBase.cs @@ -1,15 +1,14 @@ using System.ComponentModel; -namespace HierarchyBeforeAfterAndSimple +namespace HierarchyBeforeAfterAndSimple; + +public class ClassBase : + INotifyPropertyChanged { - public class ClassBase : - INotifyPropertyChanged - { - public event PropertyChangedEventHandler PropertyChanged; + public event PropertyChangedEventHandler PropertyChanged; - public void OnPropertyChanged(string propertyName) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + public void OnPropertyChanged(string propertyName) + { + PropertyChanged?.Invoke(this, new(propertyName)); } } \ No newline at end of file diff --git a/TestAssemblies/AssemblyToProcess/HierarchyBeforeAfterAndSimple/ClassChild.cs b/TestAssemblies/AssemblyToProcess/HierarchyBeforeAfterAndSimple/ClassChild.cs index 0bb40258..34e4135c 100644 --- a/TestAssemblies/AssemblyToProcess/HierarchyBeforeAfterAndSimple/ClassChild.cs +++ b/TestAssemblies/AssemblyToProcess/HierarchyBeforeAfterAndSimple/ClassChild.cs @@ -1,19 +1,17 @@ using PropertyChanged; -namespace HierarchyBeforeAfterAndSimple -{ - public class ClassChild : ClassBase - { +namespace HierarchyBeforeAfterAndSimple; - public string Property1 { get; set; } +public class ClassChild : ClassBase +{ + public string Property1 { get; set; } - [DoNotNotify] - public bool BeforeAfterCalled { get; set; } + [DoNotNotify] + public bool BeforeAfterCalled { get; set; } - public void OnPropertyChanged(string propertyName, object before, object after) - { - BeforeAfterCalled = true; - OnPropertyChanged(propertyName); - } + public void OnPropertyChanged(string propertyName, object before, object after) + { + BeforeAfterCalled = true; + OnPropertyChanged(propertyName); } } \ No newline at end of file diff --git a/TestAssemblies/AssemblyToProcess/NotifyInChild/ClassWithNotifyInChildByAttribute.cs b/TestAssemblies/AssemblyToProcess/NotifyInChild/ClassWithNotifyInChildByAttribute.cs index ab49e926..f36add9b 100644 --- a/TestAssemblies/AssemblyToProcess/NotifyInChild/ClassWithNotifyInChildByAttribute.cs +++ b/TestAssemblies/AssemblyToProcess/NotifyInChild/ClassWithNotifyInChildByAttribute.cs @@ -1,6 +1,6 @@ using PropertyChanged; -[AddINotifyPropertyChangedInterfaceAttribute] +[AddINotifyPropertyChangedInterface] public class ClassWithNotifyInChildByAttribute : ParentClass { public string Property { get; set; } diff --git a/TestAssemblies/AssemblyToProcess/NotifyInChild/ParentClass.cs b/TestAssemblies/AssemblyToProcess/NotifyInChild/ParentClass.cs index df1d679a..dea22a77 100644 --- a/TestAssemblies/AssemblyToProcess/NotifyInChild/ParentClass.cs +++ b/TestAssemblies/AssemblyToProcess/NotifyInChild/ParentClass.cs @@ -1,3 +1 @@ -public class ParentClass -{ -} \ No newline at end of file +public class ParentClass; \ No newline at end of file diff --git a/TestAssemblies/AssemblyToProcess/OnceRemovedINotify/INotifyPropertyChangedChild.cs b/TestAssemblies/AssemblyToProcess/OnceRemovedINotify/INotifyPropertyChangedChild.cs index 3b461609..9b10a1e6 100644 --- a/TestAssemblies/AssemblyToProcess/OnceRemovedINotify/INotifyPropertyChangedChild.cs +++ b/TestAssemblies/AssemblyToProcess/OnceRemovedINotify/INotifyPropertyChangedChild.cs @@ -1,6 +1,4 @@ using System.ComponentModel; public interface INotifyPropertyChangedChild : - INotifyPropertyChanged -{ -} \ No newline at end of file + INotifyPropertyChanged; \ No newline at end of file diff --git a/TestAssemblies/AssemblyToProcess/SupportedLibraries/BaseClasses.cs b/TestAssemblies/AssemblyToProcess/SupportedLibraries/BaseClasses.cs index 32254d6b..78c95b9e 100644 --- a/TestAssemblies/AssemblyToProcess/SupportedLibraries/BaseClasses.cs +++ b/TestAssemblies/AssemblyToProcess/SupportedLibraries/BaseClasses.cs @@ -11,7 +11,7 @@ public class PropertyChangedBase : public virtual void NotifyOfPropertyChange(string propertyName) { BaseNotifyCalled = true; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + PropertyChanged?.Invoke(this, new(propertyName)); } } } @@ -27,7 +27,7 @@ public class ObservableObject : protected void RaisePropertyChanged(string propertyName) { BaseNotifyCalled = true; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + PropertyChanged?.Invoke(this, new(propertyName)); } } } @@ -43,7 +43,7 @@ public abstract class ViewModelBase : void RaisePropertyChanged(string propertyName) { BaseNotifyCalled = true; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + PropertyChanged?.Invoke(this, new(propertyName)); } protected virtual void OnPropertyChanged(string propertyName) @@ -63,7 +63,7 @@ public abstract class PresentationObject : protected void NotifyChanged(string propertyName) { BaseNotifyCalled = true; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + PropertyChanged?.Invoke(this, new(propertyName)); } protected void NotifyChanged(string propertyName, params string[] otherProperties) { @@ -83,7 +83,7 @@ public class ViewModelBase : public virtual void NotifyPropertyChanged(string propertyName) { BaseNotifyCalled = true; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + PropertyChanged?.Invoke(this, new(propertyName)); } } } @@ -91,9 +91,7 @@ public virtual void NotifyPropertyChanged(string propertyName) namespace GalaSoft.MvvmLight { public class ViewModelBase : - ObservableObject - { - } + ObservableObject; public class ObservableObject : INotifyPropertyChanged @@ -104,7 +102,7 @@ public class ObservableObject : public virtual void RaisePropertyChanged(string propertyName) { BaseNotifyCalled = true; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + PropertyChanged?.Invoke(this, new(propertyName)); } } } @@ -120,7 +118,7 @@ public class PropertyChangedBase : public virtual void NotifyOfPropertyChange(string propertyName) { BaseNotifyCalled = true; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + PropertyChanged?.Invoke(this, new(propertyName)); } } } @@ -136,7 +134,7 @@ public abstract class BaseNotify : protected virtual void RaisePropertyChanged(string propertyName) { BaseNotifyCalled = true; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + PropertyChanged?.Invoke(this, new(propertyName)); } } } @@ -144,9 +142,7 @@ protected virtual void RaisePropertyChanged(string propertyName) namespace Jounce.Core.ViewModel { public abstract class BaseViewModel : - BaseNotify - { - } + BaseNotify; } namespace ReactiveUI diff --git a/TestAssemblies/AssemblyToProcess/WithInitializedProperties/ObservableTestObject.cs b/TestAssemblies/AssemblyToProcess/WithInitializedProperties/ObservableTestObject.cs index 2115a181..fc949150 100644 --- a/TestAssemblies/AssemblyToProcess/WithInitializedProperties/ObservableTestObject.cs +++ b/TestAssemblies/AssemblyToProcess/WithInitializedProperties/ObservableTestObject.cs @@ -14,6 +14,6 @@ public abstract class ObservableTestObject : protected virtual void OnPropertyChanged(string propertyName) { PropertyChangedCalls.Add(propertyName); - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + PropertyChanged?.Invoke(this, new(propertyName)); } } \ No newline at end of file diff --git a/TestAssemblies/AssemblyWithBadNamedInvoker/BaseClass.cs b/TestAssemblies/AssemblyWithBadNamedInvoker/BaseClass.cs index 7884a749..8e54b21e 100644 --- a/TestAssemblies/AssemblyWithBadNamedInvoker/BaseClass.cs +++ b/TestAssemblies/AssemblyWithBadNamedInvoker/BaseClass.cs @@ -7,6 +7,6 @@ public class BaseClass : public void OnPropertyChanged2(string text1) { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(text1)); + PropertyChanged?.Invoke(this, new(text1)); } } \ No newline at end of file diff --git a/TestAssemblies/AssemblyWithBase/BaseWithEquals/BaseClass1.cs b/TestAssemblies/AssemblyWithBase/BaseWithEquals/BaseClass1.cs index 0c44961a..2a568cdc 100644 --- a/TestAssemblies/AssemblyWithBase/BaseWithEquals/BaseClass1.cs +++ b/TestAssemblies/AssemblyWithBase/BaseWithEquals/BaseClass1.cs @@ -1,53 +1,52 @@ using System.ComponentModel; using System.Runtime.CompilerServices; -namespace AssemblyWithBase.BaseWithEquals -{ - public class BaseClass1 : +namespace AssemblyWithBase.BaseWithEquals; + +public class BaseClass1 : INotifyPropertyChanged { - public event PropertyChangedEventHandler PropertyChanged; + public event PropertyChangedEventHandler PropertyChanged; - public static bool EqualsCalled { get; set; } + public static bool EqualsCalled { get; set; } - protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new(propertyName)); + } - public static bool operator ==(BaseClass1 first, BaseClass1 second) - { - EqualsCalled = true; - return false; - } + public static bool operator ==(BaseClass1 first, BaseClass1 second) + { + EqualsCalled = true; + return false; + } + + public static bool operator !=(BaseClass1 first, BaseClass1 second) + { + return false; + } - public static bool operator !=(BaseClass1 first, BaseClass1 second) + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) { return false; } - public override bool Equals(object obj) + if (ReferenceEquals(this, obj)) { - if (ReferenceEquals(null, obj)) - { - return false; - } - - if (ReferenceEquals(this, obj)) - { - return true; - } - - if (obj.GetType() != GetType()) - { - return false; - } - - return Equals((BaseClass1)obj); + return true; } - public override int GetHashCode() + if (obj.GetType() != GetType()) { - return base.GetHashCode(); + return false; } + + return Equals((BaseClass1)obj); + } + + public override int GetHashCode() + { + return base.GetHashCode(); } -} +} \ No newline at end of file diff --git a/TestAssemblies/AssemblyWithBase/BaseWithGenericParent/BaseClass1.cs b/TestAssemblies/AssemblyWithBase/BaseWithGenericParent/BaseClass1.cs index e89d9fa3..3ef0ad3a 100644 --- a/TestAssemblies/AssemblyWithBase/BaseWithGenericParent/BaseClass1.cs +++ b/TestAssemblies/AssemblyWithBase/BaseWithGenericParent/BaseClass1.cs @@ -1,13 +1,12 @@ using System.ComponentModel; -namespace AssemblyWithBase.BaseWithGenericParent -{ - public class BaseClass1 : +namespace AssemblyWithBase.BaseWithGenericParent; + +public class BaseClass1 : INotifyPropertyChanged { - public event PropertyChangedEventHandler PropertyChanged; - public virtual void OnPropertyChanged(string propertyName) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + public event PropertyChangedEventHandler PropertyChanged; + public virtual void OnPropertyChanged(string propertyName) + { + PropertyChanged?.Invoke(this, new(propertyName)); } } \ No newline at end of file diff --git a/TestAssemblies/AssemblyWithBase/BaseWithGenericParent/BaseClass2.cs b/TestAssemblies/AssemblyWithBase/BaseWithGenericParent/BaseClass2.cs index 97be4ca9..35f1a5e0 100644 --- a/TestAssemblies/AssemblyWithBase/BaseWithGenericParent/BaseClass2.cs +++ b/TestAssemblies/AssemblyWithBase/BaseWithGenericParent/BaseClass2.cs @@ -1,6 +1,3 @@ -namespace AssemblyWithBase.BaseWithGenericParent -{ - public class BaseClass2 : BaseClass1 - { - } -} \ No newline at end of file +namespace AssemblyWithBase.BaseWithGenericParent; + +public class BaseClass2 : BaseClass1; \ No newline at end of file diff --git a/TestAssemblies/AssemblyWithBase/DirectGeneric/BaseClass.cs b/TestAssemblies/AssemblyWithBase/DirectGeneric/BaseClass.cs index a4c62f5e..871b60bc 100644 --- a/TestAssemblies/AssemblyWithBase/DirectGeneric/BaseClass.cs +++ b/TestAssemblies/AssemblyWithBase/DirectGeneric/BaseClass.cs @@ -1,13 +1,12 @@ using System.ComponentModel; -namespace AssemblyWithBase.DirectGeneric -{ - public class BaseClass : +namespace AssemblyWithBase.DirectGeneric; + +public class BaseClass : INotifyPropertyChanged { - public event PropertyChangedEventHandler PropertyChanged; - public virtual void OnPropertyChanged(string propertyName) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + public event PropertyChangedEventHandler PropertyChanged; + public virtual void OnPropertyChanged(string propertyName) + { + PropertyChanged?.Invoke(this, new(propertyName)); } } \ No newline at end of file diff --git a/TestAssemblies/AssemblyWithBase/GenericFromAbove/BaseClass1.cs b/TestAssemblies/AssemblyWithBase/GenericFromAbove/BaseClass1.cs index e3758f93..e4842c4e 100644 --- a/TestAssemblies/AssemblyWithBase/GenericFromAbove/BaseClass1.cs +++ b/TestAssemblies/AssemblyWithBase/GenericFromAbove/BaseClass1.cs @@ -1,6 +1,3 @@ -namespace AssemblyWithBase.GenericFromAbove -{ - public class BaseClass1 - { - } -} \ No newline at end of file +namespace AssemblyWithBase.GenericFromAbove; + +public class BaseClass1; \ No newline at end of file diff --git a/TestAssemblies/AssemblyWithBase/GenericFromAbove/BaseClass2.cs b/TestAssemblies/AssemblyWithBase/GenericFromAbove/BaseClass2.cs index f91c98f2..cffb46f3 100644 --- a/TestAssemblies/AssemblyWithBase/GenericFromAbove/BaseClass2.cs +++ b/TestAssemblies/AssemblyWithBase/GenericFromAbove/BaseClass2.cs @@ -1,16 +1,14 @@ using System.ComponentModel; -namespace AssemblyWithBase.GenericFromAbove +namespace AssemblyWithBase.GenericFromAbove; + +public class BaseClass2 : BaseClass1; + +public class BaseClass3 : BaseClass2, INotifyPropertyChanged { - public class BaseClass2 : BaseClass1 - { - } - public class BaseClass3 : BaseClass2, INotifyPropertyChanged + public event PropertyChangedEventHandler PropertyChanged; + public virtual void OnPropertyChanged(string propertyName) { - public event PropertyChangedEventHandler PropertyChanged; - public virtual void OnPropertyChanged(string propertyName) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + PropertyChanged?.Invoke(this, new(propertyName)); } } \ No newline at end of file diff --git a/TestAssemblies/AssemblyWithBase/GenericMiddle/BaseClassWithGenericMiddle.cs b/TestAssemblies/AssemblyWithBase/GenericMiddle/BaseClassWithGenericMiddle.cs index d98c7bb1..2196a725 100644 --- a/TestAssemblies/AssemblyWithBase/GenericMiddle/BaseClassWithGenericMiddle.cs +++ b/TestAssemblies/AssemblyWithBase/GenericMiddle/BaseClassWithGenericMiddle.cs @@ -1,3 +1 @@ -public class BaseClassWithGenericMiddle : BaseClassWithGenericMiddleBase -{ -} +public class BaseClassWithGenericMiddle : BaseClassWithGenericMiddleBase; diff --git a/TestAssemblies/AssemblyWithBase/GenericMiddle/BaseClassWithGenericMiddleBase.cs b/TestAssemblies/AssemblyWithBase/GenericMiddle/BaseClassWithGenericMiddleBase.cs index 5a232133..5ae560d4 100644 --- a/TestAssemblies/AssemblyWithBase/GenericMiddle/BaseClassWithGenericMiddleBase.cs +++ b/TestAssemblies/AssemblyWithBase/GenericMiddle/BaseClassWithGenericMiddleBase.cs @@ -3,9 +3,9 @@ public class BaseClassWithGenericMiddleBase : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; - + public virtual void OnPropertyChanged(string propertyName) { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + PropertyChanged?.Invoke(this, new(propertyName)); } } diff --git a/TestAssemblies/AssemblyWithBase/MultiTypes/BaseClass1.cs b/TestAssemblies/AssemblyWithBase/MultiTypes/BaseClass1.cs index edb3a9eb..0baba1f3 100644 --- a/TestAssemblies/AssemblyWithBase/MultiTypes/BaseClass1.cs +++ b/TestAssemblies/AssemblyWithBase/MultiTypes/BaseClass1.cs @@ -1,13 +1,12 @@ using System.ComponentModel; -namespace AssemblyWithBase.MultiTypes -{ - public class BaseClass1 : +namespace AssemblyWithBase.MultiTypes; + +public class BaseClass1 : INotifyPropertyChanged { - public event PropertyChangedEventHandler PropertyChanged; - public virtual void OnPropertyChanged(string propertyName) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + public event PropertyChangedEventHandler PropertyChanged; + public virtual void OnPropertyChanged(string propertyName) + { + PropertyChanged?.Invoke(this, new(propertyName)); } } \ No newline at end of file diff --git a/TestAssemblies/AssemblyWithBase/MultiTypes/BaseClass2.cs b/TestAssemblies/AssemblyWithBase/MultiTypes/BaseClass2.cs index 5d4ad095..14565dda 100644 --- a/TestAssemblies/AssemblyWithBase/MultiTypes/BaseClass2.cs +++ b/TestAssemblies/AssemblyWithBase/MultiTypes/BaseClass2.cs @@ -1,6 +1,3 @@ -namespace AssemblyWithBase.MultiTypes -{ - public class BaseClass2 : BaseClass1 - { - } -} \ No newline at end of file +namespace AssemblyWithBase.MultiTypes; + +public class BaseClass2 : BaseClass1; \ No newline at end of file diff --git a/TestAssemblies/AssemblyWithBase/Simple/BaseClass.cs b/TestAssemblies/AssemblyWithBase/Simple/BaseClass.cs index 6023feb9..2d639c0a 100644 --- a/TestAssemblies/AssemblyWithBase/Simple/BaseClass.cs +++ b/TestAssemblies/AssemblyWithBase/Simple/BaseClass.cs @@ -1,14 +1,13 @@ using System.ComponentModel; -namespace AssemblyWithBase.Simple -{ - public class BaseClass : +namespace AssemblyWithBase.Simple; + +public class BaseClass : INotifyPropertyChanged { - public event PropertyChangedEventHandler PropertyChanged; + public event PropertyChangedEventHandler PropertyChanged; - public virtual void OnPropertyChanged(string text1) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(text1)); - } + public virtual void OnPropertyChanged(string text1) + { + PropertyChanged?.Invoke(this, new(text1)); } } \ No newline at end of file diff --git a/TestAssemblies/AssemblyWithBase/Simple/BaseClassWithVirtualProperty.cs b/TestAssemblies/AssemblyWithBase/Simple/BaseClassWithVirtualProperty.cs index f1d550af..725a0944 100644 --- a/TestAssemblies/AssemblyWithBase/Simple/BaseClassWithVirtualProperty.cs +++ b/TestAssemblies/AssemblyWithBase/Simple/BaseClassWithVirtualProperty.cs @@ -1,16 +1,15 @@ -namespace AssemblyWithBase.Simple -{ - using System.ComponentModel; +namespace AssemblyWithBase.Simple; - public class BaseClassWithVirtualProperty : +using System.ComponentModel; + +public class BaseClassWithVirtualProperty : INotifyPropertyChanged { - public event PropertyChangedEventHandler PropertyChanged; + public event PropertyChangedEventHandler PropertyChanged; - public virtual string Property1 { get; set; } + public virtual string Property1 { get; set; } - public virtual void OnPropertyChanged(string text1) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(text1)); - } + public virtual void OnPropertyChanged(string text1) + { + PropertyChanged?.Invoke(this, new(text1)); } -} +} \ No newline at end of file diff --git a/TestAssemblies/AssemblyWithBase/StaticEquals/BaseClass.cs b/TestAssemblies/AssemblyWithBase/StaticEquals/BaseClass.cs index 2d9e839b..0648cd2a 100644 --- a/TestAssemblies/AssemblyWithBase/StaticEquals/BaseClass.cs +++ b/TestAssemblies/AssemblyWithBase/StaticEquals/BaseClass.cs @@ -1,29 +1,28 @@ -namespace AssemblyWithBase.StaticEquals +namespace AssemblyWithBase.StaticEquals; + +public class BaseClass { - public class BaseClass + static bool staticEqualsCalled; + public bool StaticEqualsCalled { - static bool staticEqualsCalled; - public bool StaticEqualsCalled + get => staticEqualsCalled; + set => staticEqualsCalled = value; + } + + public static bool Equals(BaseClass first, BaseClass second) + { + staticEqualsCalled = true; + + if (ReferenceEquals(first, second)) { - get => staticEqualsCalled; - set => staticEqualsCalled = value; + return true; } - public static bool Equals(BaseClass first, BaseClass second) + if (first == null || second == null) { - staticEqualsCalled = true; - - if (ReferenceEquals(first, second)) - { - return true; - } - - if (first == null || second == null) - { - return false; - } - - return first.Equals(second); + return false; } + + return first.Equals(second); } } \ No newline at end of file diff --git a/TestAssemblies/AssemblyWithBase/StaticEqualsGenericParent/BaseClass.cs b/TestAssemblies/AssemblyWithBase/StaticEqualsGenericParent/BaseClass.cs index d2284145..8b735e27 100644 --- a/TestAssemblies/AssemblyWithBase/StaticEqualsGenericParent/BaseClass.cs +++ b/TestAssemblies/AssemblyWithBase/StaticEqualsGenericParent/BaseClass.cs @@ -1,29 +1,28 @@ -namespace AssemblyWithBase.StaticEqualsGenericParent +namespace AssemblyWithBase.StaticEqualsGenericParent; + +public class BaseClass { - public class BaseClass + static bool staticEqualsCalled; + public bool StaticEqualsCalled { - static bool staticEqualsCalled; - public bool StaticEqualsCalled + get => staticEqualsCalled; + set => staticEqualsCalled = value; + } + + public static bool Equals(BaseClass first, BaseClass second) + { + staticEqualsCalled = true; + + if (ReferenceEquals(first, second)) { - get => staticEqualsCalled; - set => staticEqualsCalled = value; + return true; } - public static bool Equals(BaseClass first, BaseClass second) + if (first == null || second == null) { - staticEqualsCalled = true; - - if (ReferenceEquals(first, second)) - { - return true; - } - - if (first == null || second == null) - { - return false; - } - - return first.Equals(second); + return false; } + + return first.Equals(second); } -} +} \ No newline at end of file diff --git a/TestAssemblies/AssemblyWithBase/StaticEqualsGenericParent/BaseClass2.cs b/TestAssemblies/AssemblyWithBase/StaticEqualsGenericParent/BaseClass2.cs index 563570b0..9a6758cf 100644 --- a/TestAssemblies/AssemblyWithBase/StaticEqualsGenericParent/BaseClass2.cs +++ b/TestAssemblies/AssemblyWithBase/StaticEqualsGenericParent/BaseClass2.cs @@ -1,7 +1,6 @@ -namespace AssemblyWithBase.StaticEqualsGenericParent +namespace AssemblyWithBase.StaticEqualsGenericParent; + +public class BaseClass2 : BaseClass { - public class BaseClass2 : BaseClass - { - public T SomeProperty { get; set; } - } + public T SomeProperty { get; set; } } \ No newline at end of file diff --git a/TestAssemblies/AssemblyWithBase/StaticEqualsGenericParent/BaseClass3.cs b/TestAssemblies/AssemblyWithBase/StaticEqualsGenericParent/BaseClass3.cs index bb00e771..2adb43f8 100644 --- a/TestAssemblies/AssemblyWithBase/StaticEqualsGenericParent/BaseClass3.cs +++ b/TestAssemblies/AssemblyWithBase/StaticEqualsGenericParent/BaseClass3.cs @@ -1,5 +1,3 @@ -namespace AssemblyWithBase.StaticEqualsGenericParent -{ - public class BaseClass3 : BaseClass2 - { } -} \ No newline at end of file +namespace AssemblyWithBase.StaticEqualsGenericParent; + +public class BaseClass3 : BaseClass2; \ No newline at end of file diff --git a/TestAssemblies/AssemblyWithBase/StaticEqualsGenericParent/ClassUsingBase.cs b/TestAssemblies/AssemblyWithBase/StaticEqualsGenericParent/ClassUsingBase.cs index 3a732d11..e5145a73 100644 --- a/TestAssemblies/AssemblyWithBase/StaticEqualsGenericParent/ClassUsingBase.cs +++ b/TestAssemblies/AssemblyWithBase/StaticEqualsGenericParent/ClassUsingBase.cs @@ -1,5 +1,3 @@ -namespace AssemblyWithBase.StaticEqualsGenericParent -{ - public class ClassUsingBaseEquals : BaseClass - { } -} \ No newline at end of file +namespace AssemblyWithBase.StaticEqualsGenericParent; + +public class ClassUsingBaseEquals : BaseClass; \ No newline at end of file diff --git a/TestAssemblies/AssemblyWithBase/StaticEqualsGenericParent/ClassWithOwnEquals.cs b/TestAssemblies/AssemblyWithBase/StaticEqualsGenericParent/ClassWithOwnEquals.cs index 6a1a5b6b..09a45907 100644 --- a/TestAssemblies/AssemblyWithBase/StaticEqualsGenericParent/ClassWithOwnEquals.cs +++ b/TestAssemblies/AssemblyWithBase/StaticEqualsGenericParent/ClassWithOwnEquals.cs @@ -1,30 +1,29 @@ -namespace AssemblyWithBase.StaticEqualsGenericParent +namespace AssemblyWithBase.StaticEqualsGenericParent; + +public class ClassWithOwnEquals : BaseClass { - public class ClassWithOwnEquals : BaseClass + static bool childStaticEqualsCalled; + + public bool ChildStaticEqualsCalled + { + get => childStaticEqualsCalled; + set => childStaticEqualsCalled = value; + } + + public static bool Equals(ClassWithOwnEquals first, ClassWithOwnEquals second) { - static bool childStaticEqualsCalled; + childStaticEqualsCalled = true; - public bool ChildStaticEqualsCalled + if (ReferenceEquals(first, second)) { - get => childStaticEqualsCalled; - set => childStaticEqualsCalled = value; + return true; } - public static bool Equals(ClassWithOwnEquals first, ClassWithOwnEquals second) + if (first == null || second == null) { - childStaticEqualsCalled = true; - - if (ReferenceEquals(first, second)) - { - return true; - } - - if (first == null || second == null) - { - return false; - } - - return first.Equals(second); + return false; } + + return first.Equals(second); } } \ No newline at end of file diff --git a/TestAssemblies/AssemblyWithBase/StaticEqualsGenericParent/ClassWithTwoBaseClasses1.cs b/TestAssemblies/AssemblyWithBase/StaticEqualsGenericParent/ClassWithTwoBaseClasses1.cs index 540cb046..feba5184 100644 --- a/TestAssemblies/AssemblyWithBase/StaticEqualsGenericParent/ClassWithTwoBaseClasses1.cs +++ b/TestAssemblies/AssemblyWithBase/StaticEqualsGenericParent/ClassWithTwoBaseClasses1.cs @@ -1,5 +1,3 @@ -namespace AssemblyWithBase.StaticEqualsGenericParent -{ - public class ClassWithTwoBaseClasses1 : BaseClass2 - { } -} \ No newline at end of file +namespace AssemblyWithBase.StaticEqualsGenericParent; + +public class ClassWithTwoBaseClasses1 : BaseClass2; \ No newline at end of file diff --git a/TestAssemblies/AssemblyWithBase/StaticEqualsGenericParent/ClassWithTwoBaseClasses2.cs b/TestAssemblies/AssemblyWithBase/StaticEqualsGenericParent/ClassWithTwoBaseClasses2.cs index 9a3b6639..b2de5d5d 100644 --- a/TestAssemblies/AssemblyWithBase/StaticEqualsGenericParent/ClassWithTwoBaseClasses2.cs +++ b/TestAssemblies/AssemblyWithBase/StaticEqualsGenericParent/ClassWithTwoBaseClasses2.cs @@ -1,5 +1,3 @@ -namespace AssemblyWithBase.StaticEqualsGenericParent -{ - public class ClassWithTwoBaseClasses2 : BaseClass3 - { } -} \ No newline at end of file +namespace AssemblyWithBase.StaticEqualsGenericParent; + +public class ClassWithTwoBaseClasses2 : BaseClass3; \ No newline at end of file diff --git a/TestAssemblies/AssemblyWithBaseInDifferentModule/BaseWithGenericParent/ChildClass.cs b/TestAssemblies/AssemblyWithBaseInDifferentModule/BaseWithGenericParent/ChildClass.cs index e9eb9c18..c28889c9 100644 --- a/TestAssemblies/AssemblyWithBaseInDifferentModule/BaseWithGenericParent/ChildClass.cs +++ b/TestAssemblies/AssemblyWithBaseInDifferentModule/BaseWithGenericParent/ChildClass.cs @@ -1,9 +1,8 @@ using AssemblyWithBase.BaseWithGenericParent; -namespace AssemblyWithBaseInDifferentModule.BaseWithGenericParent +namespace AssemblyWithBaseInDifferentModule.BaseWithGenericParent; + +public class ChildClass : BaseClass2 { - public class ChildClass : BaseClass2 - { - public string Property1 { get; set; } - } + public string Property1 { get; set; } } \ No newline at end of file diff --git a/TestAssemblies/AssemblyWithBaseInDifferentModule/BaseWithGenericProperty/Class.cs b/TestAssemblies/AssemblyWithBaseInDifferentModule/BaseWithGenericProperty/Class.cs index 80fa3dfe..8bb52d95 100644 --- a/TestAssemblies/AssemblyWithBaseInDifferentModule/BaseWithGenericProperty/Class.cs +++ b/TestAssemblies/AssemblyWithBaseInDifferentModule/BaseWithGenericProperty/Class.cs @@ -2,29 +2,28 @@ using System.Runtime.CompilerServices; using AssemblyWithBase.BaseWithEquals; -namespace AssemblyWithBaseInDifferentModule.BaseWithGenericProperty -{ - public class Class : +namespace AssemblyWithBaseInDifferentModule.BaseWithGenericProperty; + +public class Class : INotifyPropertyChanged { - string property1; + string property1; - public string Property1 + public string Property1 + { + get => property1; + set { - get => property1; - set - { - property1 = value; - Property2 = new BaseClass1(); - } + property1 = value; + Property2 = new(); } + } - public BaseClass1 Property2 { get; set; } + public BaseClass1 Property2 { get; set; } - public event PropertyChangedEventHandler PropertyChanged; + public event PropertyChangedEventHandler PropertyChanged; - protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new(propertyName)); } } \ No newline at end of file diff --git a/TestAssemblies/AssemblyWithBaseInDifferentModule/DirectGeneric/ChildClass.cs b/TestAssemblies/AssemblyWithBaseInDifferentModule/DirectGeneric/ChildClass.cs index 4e564603..25c0263e 100644 --- a/TestAssemblies/AssemblyWithBaseInDifferentModule/DirectGeneric/ChildClass.cs +++ b/TestAssemblies/AssemblyWithBaseInDifferentModule/DirectGeneric/ChildClass.cs @@ -1,9 +1,8 @@ using AssemblyWithBase.DirectGeneric; -namespace AssemblyWithBaseInDifferentModule.DirectGeneric +namespace AssemblyWithBaseInDifferentModule.DirectGeneric; + +public class ChildClass : BaseClass { - public class ChildClass : BaseClass - { - public string Property1 { get; set; } - } + public string Property1 { get; set; } } \ No newline at end of file diff --git a/TestAssemblies/AssemblyWithBaseInDifferentModule/GenericFromAbove/ChildClass.cs b/TestAssemblies/AssemblyWithBaseInDifferentModule/GenericFromAbove/ChildClass.cs index 56e2a475..4caeab6a 100644 --- a/TestAssemblies/AssemblyWithBaseInDifferentModule/GenericFromAbove/ChildClass.cs +++ b/TestAssemblies/AssemblyWithBaseInDifferentModule/GenericFromAbove/ChildClass.cs @@ -1,9 +1,8 @@ using AssemblyWithBase.GenericFromAbove; -namespace AssemblyWithBaseInDifferentModule.GenericFromAbove +namespace AssemblyWithBaseInDifferentModule.GenericFromAbove; + +public class ChildClass : BaseClass3 { - public class ChildClass : BaseClass3 - { - public string Property1 { get; set; } - } + public string Property1 { get; set; } } \ No newline at end of file diff --git a/TestAssemblies/AssemblyWithBaseInDifferentModule/Hierarchy/ChildClass.cs b/TestAssemblies/AssemblyWithBaseInDifferentModule/Hierarchy/ChildClass.cs index 2b0f0b51..b0235dac 100644 --- a/TestAssemblies/AssemblyWithBaseInDifferentModule/Hierarchy/ChildClass.cs +++ b/TestAssemblies/AssemblyWithBaseInDifferentModule/Hierarchy/ChildClass.cs @@ -1,20 +1,19 @@ -namespace AssemblyWithBaseInDifferentModule.Hierarchy -{ - using AssemblyWithBase.StaticEquals; +namespace AssemblyWithBaseInDifferentModule.Hierarchy; + +using AssemblyWithBase.StaticEquals; - public class ChildClass : StaticEquals +public class ChildClass : StaticEquals +{ + string property1; + public string Property1 { - string property1; - public string Property1 + get => property1; + set { - get => property1; - set - { - property1 = value; - Property2 = new BaseClass(); - } + property1 = value; + Property2 = new(); } - - public BaseClass Property2 { get; set; } } + + public BaseClass Property2 { get; set; } } \ No newline at end of file diff --git a/TestAssemblies/AssemblyWithBaseInDifferentModule/Hierarchy/StaticEquals.cs b/TestAssemblies/AssemblyWithBaseInDifferentModule/Hierarchy/StaticEquals.cs index b2e93953..4a0bce8c 100644 --- a/TestAssemblies/AssemblyWithBaseInDifferentModule/Hierarchy/StaticEquals.cs +++ b/TestAssemblies/AssemblyWithBaseInDifferentModule/Hierarchy/StaticEquals.cs @@ -1,14 +1,15 @@ using System.ComponentModel; using System.Runtime.CompilerServices; -namespace AssemblyWithBaseInDifferentModule.Hierarchy +namespace AssemblyWithBaseInDifferentModule.Hierarchy; + +public class StaticEquals : + INotifyPropertyChanged { - public class StaticEquals : - INotifyPropertyChanged { - public event PropertyChangedEventHandler PropertyChanged; - protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + public event PropertyChangedEventHandler PropertyChanged; + + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new(propertyName)); } } \ No newline at end of file diff --git a/TestAssemblies/AssemblyWithBaseInDifferentModule/MultiTypes/ChildClass.cs b/TestAssemblies/AssemblyWithBaseInDifferentModule/MultiTypes/ChildClass.cs index d1875fdf..286b9ab3 100644 --- a/TestAssemblies/AssemblyWithBaseInDifferentModule/MultiTypes/ChildClass.cs +++ b/TestAssemblies/AssemblyWithBaseInDifferentModule/MultiTypes/ChildClass.cs @@ -1,9 +1,8 @@ using AssemblyWithBase.MultiTypes; -namespace AssemblyWithBaseInDifferentModule.MultiTypes +namespace AssemblyWithBaseInDifferentModule.MultiTypes; + +public class ChildClass : BaseClass2 { - public class ChildClass : BaseClass2 - { - public string Property1 { get; set; } - } + public string Property1 { get; set; } } \ No newline at end of file diff --git a/TestAssemblies/AssemblyWithBaseInDifferentModule/Simple/ChildClass.cs b/TestAssemblies/AssemblyWithBaseInDifferentModule/Simple/ChildClass.cs index ee1c4a5a..8694d424 100644 --- a/TestAssemblies/AssemblyWithBaseInDifferentModule/Simple/ChildClass.cs +++ b/TestAssemblies/AssemblyWithBaseInDifferentModule/Simple/ChildClass.cs @@ -1,9 +1,8 @@ using AssemblyWithBase.Simple; -namespace AssemblyWithBaseInDifferentModule.Simple +namespace AssemblyWithBaseInDifferentModule.Simple; + +public class ChildClass : BaseClass { - public class ChildClass : BaseClass - { - public string Property1 { get; set; } - } -} + public string Property1 { get; set; } +} \ No newline at end of file diff --git a/TestAssemblies/AssemblyWithBaseInDifferentModule/StaticEquals/StaticEquals.cs b/TestAssemblies/AssemblyWithBaseInDifferentModule/StaticEquals/StaticEquals.cs index cbcca92c..28c0b09c 100644 --- a/TestAssemblies/AssemblyWithBaseInDifferentModule/StaticEquals/StaticEquals.cs +++ b/TestAssemblies/AssemblyWithBaseInDifferentModule/StaticEquals/StaticEquals.cs @@ -2,27 +2,26 @@ using System.Runtime.CompilerServices; using AssemblyWithBase.StaticEquals; -namespace AssemblyWithBaseInDifferentModule.StaticEquals -{ - public class StaticEquals : +namespace AssemblyWithBaseInDifferentModule.StaticEquals; + +public class StaticEquals : INotifyPropertyChanged { - string property1; - public string Property1 + string property1; + public string Property1 + { + get => property1; + set { - get => property1; - set - { - property1 = value; - Property2 = new BaseClass(); - } + property1 = value; + Property2 = new(); } + } - public BaseClass Property2 { get; set; } + public BaseClass Property2 { get; set; } - public event PropertyChangedEventHandler PropertyChanged; - protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + public event PropertyChangedEventHandler PropertyChanged; + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new(propertyName)); } } \ No newline at end of file diff --git a/TestAssemblies/AssemblyWithBaseInDifferentModule/StaticEqualsGenericParent/ArgsMapping1.cs b/TestAssemblies/AssemblyWithBaseInDifferentModule/StaticEqualsGenericParent/ArgsMapping1.cs index b61ed25d..fe4bbea4 100644 --- a/TestAssemblies/AssemblyWithBaseInDifferentModule/StaticEqualsGenericParent/ArgsMapping1.cs +++ b/TestAssemblies/AssemblyWithBaseInDifferentModule/StaticEqualsGenericParent/ArgsMapping1.cs @@ -2,27 +2,26 @@ using System.Runtime.CompilerServices; using AssemblyWithBase.StaticEqualsGenericParent; -namespace AssemblyWithBaseInDifferentModule.StaticEqualsGenericParent -{ - public class ArgsMapping1 : +namespace AssemblyWithBaseInDifferentModule.StaticEqualsGenericParent; + +public class ArgsMapping1 : INotifyPropertyChanged { - string property1; - public string Property1 + string property1; + public string Property1 + { + get => property1; + set { - get => property1; - set - { - property1 = value; - Property2 = new ClassWithTwoBaseClasses1(); - } + property1 = value; + Property2 = new(); } + } - public ClassWithTwoBaseClasses1 Property2 { get; set; } + public ClassWithTwoBaseClasses1 Property2 { get; set; } - public event PropertyChangedEventHandler PropertyChanged; - protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + public event PropertyChangedEventHandler PropertyChanged; + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new(propertyName)); } } \ No newline at end of file diff --git a/TestAssemblies/AssemblyWithBaseInDifferentModule/StaticEqualsGenericParent/ArgsMapping2.cs b/TestAssemblies/AssemblyWithBaseInDifferentModule/StaticEqualsGenericParent/ArgsMapping2.cs index 395c2ace..7a193fbe 100644 --- a/TestAssemblies/AssemblyWithBaseInDifferentModule/StaticEqualsGenericParent/ArgsMapping2.cs +++ b/TestAssemblies/AssemblyWithBaseInDifferentModule/StaticEqualsGenericParent/ArgsMapping2.cs @@ -2,27 +2,26 @@ using System.Runtime.CompilerServices; using AssemblyWithBase.StaticEqualsGenericParent; -namespace AssemblyWithBaseInDifferentModule.StaticEqualsGenericParent -{ - public class ArgsMapping2 : +namespace AssemblyWithBaseInDifferentModule.StaticEqualsGenericParent; + +public class ArgsMapping2 : INotifyPropertyChanged { - string property1; - public string Property1 + string property1; + public string Property1 + { + get => property1; + set { - get => property1; - set - { - property1 = value; - Property2 = new ClassWithTwoBaseClasses2(); - } + property1 = value; + Property2 = new(); } + } - public ClassWithTwoBaseClasses2 Property2 { get; set; } + public ClassWithTwoBaseClasses2 Property2 { get; set; } - public event PropertyChangedEventHandler PropertyChanged; - protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + public event PropertyChangedEventHandler PropertyChanged; + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new(propertyName)); } } \ No newline at end of file diff --git a/TestAssemblies/AssemblyWithBaseInDifferentModule/StaticEqualsGenericParent/OwnStaticEquals.cs b/TestAssemblies/AssemblyWithBaseInDifferentModule/StaticEqualsGenericParent/OwnStaticEquals.cs index 23e583b8..ed3d402c 100644 --- a/TestAssemblies/AssemblyWithBaseInDifferentModule/StaticEqualsGenericParent/OwnStaticEquals.cs +++ b/TestAssemblies/AssemblyWithBaseInDifferentModule/StaticEqualsGenericParent/OwnStaticEquals.cs @@ -2,27 +2,26 @@ using System.Runtime.CompilerServices; using AssemblyWithBase.StaticEqualsGenericParent; -namespace AssemblyWithBaseInDifferentModule.StaticEqualsGenericParent -{ - public class OwnStaticEquals : +namespace AssemblyWithBaseInDifferentModule.StaticEqualsGenericParent; + +public class OwnStaticEquals : INotifyPropertyChanged { - string property1; - public string Property1 + string property1; + public string Property1 + { + get => property1; + set { - get => property1; - set - { - property1 = value; - Property2 = new ClassWithOwnEquals(); - } + property1 = value; + Property2 = new(); } + } - public ClassWithOwnEquals Property2 { get; set; } + public ClassWithOwnEquals Property2 { get; set; } - public event PropertyChangedEventHandler PropertyChanged; - protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + public event PropertyChangedEventHandler PropertyChanged; + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new(propertyName)); } } \ No newline at end of file diff --git a/TestAssemblies/AssemblyWithBaseInDifferentModule/StaticEqualsGenericParent/StaticEquals.cs b/TestAssemblies/AssemblyWithBaseInDifferentModule/StaticEqualsGenericParent/StaticEquals.cs index 6eb0e93a..0b67436b 100644 --- a/TestAssemblies/AssemblyWithBaseInDifferentModule/StaticEqualsGenericParent/StaticEquals.cs +++ b/TestAssemblies/AssemblyWithBaseInDifferentModule/StaticEqualsGenericParent/StaticEquals.cs @@ -2,27 +2,26 @@ using System.Runtime.CompilerServices; using AssemblyWithBase.StaticEqualsGenericParent; -namespace AssemblyWithBaseInDifferentModule.StaticEqualsGenericParent -{ - public class StaticEquals : +namespace AssemblyWithBaseInDifferentModule.StaticEqualsGenericParent; + +public class StaticEquals : INotifyPropertyChanged { - string property1; - public string Property1 + string property1; + public string Property1 + { + get => property1; + set { - get => property1; - set - { - property1 = value; - Property2 = new BaseClass(); - } + property1 = value; + Property2 = new(); } + } - public BaseClass Property2 { get; set; } + public BaseClass Property2 { get; set; } - public event PropertyChangedEventHandler PropertyChanged; - protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + public event PropertyChangedEventHandler PropertyChanged; + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new(propertyName)); } } \ No newline at end of file diff --git a/TestAssemblies/AssemblyWithBaseInDifferentModule/StaticEqualsGenericParent/StaticEqualsOnBase.cs b/TestAssemblies/AssemblyWithBaseInDifferentModule/StaticEqualsGenericParent/StaticEqualsOnBase.cs index 6bdb3159..142f6d3c 100644 --- a/TestAssemblies/AssemblyWithBaseInDifferentModule/StaticEqualsGenericParent/StaticEqualsOnBase.cs +++ b/TestAssemblies/AssemblyWithBaseInDifferentModule/StaticEqualsGenericParent/StaticEqualsOnBase.cs @@ -2,27 +2,26 @@ using System.Runtime.CompilerServices; using AssemblyWithBase.StaticEqualsGenericParent; -namespace AssemblyWithBaseInDifferentModule.StaticEqualsGenericParent -{ - public class StaticEqualsOnBase : +namespace AssemblyWithBaseInDifferentModule.StaticEqualsGenericParent; + +public class StaticEqualsOnBase : INotifyPropertyChanged { - string property1; - public string Property1 + string property1; + public string Property1 + { + get => property1; + set { - get => property1; - set - { - property1 = value; - Property2 = new ClassUsingBaseEquals(); - } + property1 = value; + Property2 = new(); } + } - public ClassUsingBaseEquals Property2 { get; set; } + public ClassUsingBaseEquals Property2 { get; set; } - public event PropertyChangedEventHandler PropertyChanged; - protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + public event PropertyChangedEventHandler PropertyChanged; + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new(propertyName)); } } \ No newline at end of file diff --git a/TestAssemblies/AssemblyWithBlockingClass/Classes.cs b/TestAssemblies/AssemblyWithBlockingClass/Classes.cs index 04d6b708..12ec4279 100644 --- a/TestAssemblies/AssemblyWithBlockingClass/Classes.cs +++ b/TestAssemblies/AssemblyWithBlockingClass/Classes.cs @@ -2,9 +2,7 @@ using System.ComponentModel; public class A : - ObservableCollection -{ -} + ObservableCollection; public class B : INotifyPropertyChanged @@ -15,6 +13,6 @@ public class B : public void OnPropertyChanged(string propertyName) { - PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + PropertyChanged(this, new(propertyName)); } } \ No newline at end of file diff --git a/TestAssemblies/AssemblyWithDisabledTriggerDependentProperties/DependentPropertiesClassToTest.cs b/TestAssemblies/AssemblyWithDisabledTriggerDependentProperties/DependentPropertiesClassToTest.cs index 4fc1f2c0..fc1e3e34 100644 --- a/TestAssemblies/AssemblyWithDisabledTriggerDependentProperties/DependentPropertiesClassToTest.cs +++ b/TestAssemblies/AssemblyWithDisabledTriggerDependentProperties/DependentPropertiesClassToTest.cs @@ -25,6 +25,6 @@ public virtual void OnPropertyChanged(string propertyName) break; } - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + PropertyChanged?.Invoke(this, new(propertyName)); } } \ No newline at end of file diff --git a/TestAssemblies/AssemblyWithInheritance/Classes.cs b/TestAssemblies/AssemblyWithInheritance/Classes.cs index 2fbda90c..d2f4ba1f 100644 --- a/TestAssemblies/AssemblyWithInheritance/Classes.cs +++ b/TestAssemblies/AssemblyWithInheritance/Classes.cs @@ -23,7 +23,7 @@ public abstract class BaseClass : INotifyPropertyChanged protected void OnPropertyChanged(string propertyName) { Notifications.Add(propertyName); - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + PropertyChanged?.Invoke(this, new(propertyName)); } void OnProperty1Changed() @@ -283,7 +283,7 @@ void ReportOnChanged([CallerMemberName] string callerMemberName = null) protected void OnPropertyChanged(string propertyName) { Notifications.Add(propertyName); - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + PropertyChanged?.Invoke(this, new(propertyName)); } } diff --git a/TestAssemblies/AssemblyWithStackOverflow/BaseClass.cs b/TestAssemblies/AssemblyWithStackOverflow/BaseClass.cs index aa370a87..71cd0d07 100644 --- a/TestAssemblies/AssemblyWithStackOverflow/BaseClass.cs +++ b/TestAssemblies/AssemblyWithStackOverflow/BaseClass.cs @@ -9,6 +9,6 @@ public class BaseClass : protected void OnPropertyChanged(string propertyName, object before, object after) { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + PropertyChanged?.Invoke(this, new(propertyName)); } } \ No newline at end of file diff --git a/TestAssemblies/AssemblyWithStackOverflow/ClassWithStackOverflow.cs b/TestAssemblies/AssemblyWithStackOverflow/ClassWithStackOverflow.cs index b5cc8bb6..3d130d17 100644 --- a/TestAssemblies/AssemblyWithStackOverflow/ClassWithStackOverflow.cs +++ b/TestAssemblies/AssemblyWithStackOverflow/ClassWithStackOverflow.cs @@ -25,6 +25,6 @@ public string Name protected void OnPropertyChanged(string propertyName, object before, object after) { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + PropertyChanged?.Invoke(this, new(propertyName)); } } \ No newline at end of file diff --git a/TestAssemblies/AssemblyWithTypeFilter/TestClassInclude.cs b/TestAssemblies/AssemblyWithTypeFilter/TestClassInclude.cs index c9e4defd..c5ed818c 100644 --- a/TestAssemblies/AssemblyWithTypeFilter/TestClassInclude.cs +++ b/TestAssemblies/AssemblyWithTypeFilter/TestClassInclude.cs @@ -1,11 +1,10 @@ using System.ComponentModel; -namespace PropertyChangedTest -{ - public class TestClassInclude : +namespace PropertyChangedTest; + +public class TestClassInclude : INotifyPropertyChanged { - public string Property1 { get; set; } + public string Property1 { get; set; } - public event PropertyChangedEventHandler PropertyChanged; - } + public event PropertyChangedEventHandler PropertyChanged; } \ No newline at end of file diff --git a/TestAssemblies/AssemblyWithTypeFilter/TestClassIncludeAlso.cs b/TestAssemblies/AssemblyWithTypeFilter/TestClassIncludeAlso.cs index 01065083..96cdb194 100644 --- a/TestAssemblies/AssemblyWithTypeFilter/TestClassIncludeAlso.cs +++ b/TestAssemblies/AssemblyWithTypeFilter/TestClassIncludeAlso.cs @@ -1,11 +1,10 @@ using System.ComponentModel; -namespace PropertyChangedTestWithDifferentNamespace -{ - public class TestClassIncludeAlso : +namespace PropertyChangedTestWithDifferentNamespace; + +public class TestClassIncludeAlso : INotifyPropertyChanged { - public string Property1 { get; set; } + public string Property1 { get; set; } - public event PropertyChangedEventHandler PropertyChanged; - } + public event PropertyChangedEventHandler PropertyChanged; } \ No newline at end of file diff --git a/Tests/AssemblyToProcessTests.cs b/Tests/AssemblyToProcessTests.cs index 82d49ff5..e7555423 100644 --- a/Tests/AssemblyToProcessTests.cs +++ b/Tests/AssemblyToProcessTests.cs @@ -10,9 +10,8 @@ using Xunit; using Xunit.Abstractions; -public class AssemblyToProcessTests +public class AssemblyToProcessTests(ITestOutputHelper outputHelper) { - readonly ITestOutputHelper outputHelper; static TestResult testResult; static AssemblyToProcessTests() @@ -27,11 +26,6 @@ static AssemblyToProcessTests() ); } - public AssemblyToProcessTests(ITestOutputHelper outputHelper) - { - this.outputHelper = outputHelper; - } - [Theory] [InlineData("ClassWithInlineInitializedAutoProperties", "Test", "Test2", false, new string[0])] @@ -302,7 +296,7 @@ public void IgnoreSuppressedProperties() [Fact] public void IgnoreSuppressedClasses() { - const string className = nameof(ClassWithSuppressedInvalidOnChanged); + const string className = nameof(ClassWithSuppressedInvalidOnChanged); Assert.DoesNotContain(testResult.Warnings, w => w.Text.Contains(className) && w.Text.Contains(nameof(ClassWithSuppressedInvalidOnChanged.OnNonExistingPropertyChanged))); } @@ -527,7 +521,7 @@ public void OnChangedMethodAttributeSuppressedDefaultMethodsWhenMethodNameIsNull Assert.False(instance.OnProperty1ChangedCalled); Assert.False(instance.OnProperty2ChangedCalled); - + Assert.Contains(testResult.Warnings, w => w.Text.ContainsWholeWord(nameof(ClassWithOnChangedSuppressed)) && w.Text.Contains(nameof(ClassWithOnChangedSuppressed.Property1))); Assert.Contains(testResult.Warnings, w => w.Text.ContainsWholeWord(nameof(ClassWithOnChangedSuppressed)) && w.Text.Contains(nameof(ClassWithOnChangedSuppressed.Property2))); } @@ -536,7 +530,7 @@ public void OnChangedMethodAttributeSuppressedDefaultMethodsWhenMethodNameIsNull public void ClassWithIntermediateGenericBaseHandlesPropertyChanged() { var instance = testResult.GetInstance(nameof(ClassWithIntermediateGenericBase)); - + var argsList = new List(); ((INotifyPropertyChanged)instance).PropertyChanged += (sender, args) => argsList.Add(args); @@ -549,7 +543,7 @@ public void ClassWithIntermediateGenericBaseHandlesPropertyChanged() Assert.Equal("Property2", argsList[1].PropertyName); Assert.Equal("Property3", argsList[2].PropertyName); } - + [Fact] public void EventInvokersUseCorrectMethodDeclaringType() { @@ -558,17 +552,17 @@ public void EventInvokersUseCorrectMethodDeclaringType() // Non generic AssertInvoker(typeof(ClassChild1), nameof(ClassChild1.Property1), typeof(ClassParent).FullName); AssertInvoker(typeof(ClassChild3), nameof(ClassChild3.Property2), typeof(ClassParent).FullName); - + // Issue #477 AssertInvoker(typeof(ClassWithGenericMiddleBase), nameof(ClassWithGenericMiddleBase.Property1), nameof(ClassWithGenericMiddleBase)); AssertInvoker(typeof(ClassWithGenericMiddle<>), nameof(ClassWithGenericMiddle.Property2), nameof(ClassWithGenericMiddleBase)); AssertInvoker(typeof(ClassWithGenericMiddleChild), nameof(ClassWithGenericMiddleChild.Property3), nameof(ClassWithGenericMiddleBase)); - + // Issue #516 AssertInvoker(typeof(ClassWithGenericParent<>), nameof(ClassWithGenericParent.Property1), "ClassWithGenericParent`1"); AssertInvoker(typeof(IntermediateGenericClass<>), nameof(IntermediateGenericClass.Property2), "ClassWithGenericParent`1"); AssertInvoker(typeof(ClassWithIntermediateGenericBase), nameof(ClassWithIntermediateGenericBase.Property3), "IntermediateGenericClass`1"); - + void AssertInvoker(Type type, string propertyName, string invokerDeclaringType) { var typeDef = module.GetType(type.FullName); diff --git a/Tests/AssemblyWithBaseInDifferentModuleTests.cs b/Tests/AssemblyWithBaseInDifferentModuleTests.cs index b836325a..2a2f4dbb 100644 --- a/Tests/AssemblyWithBaseInDifferentModuleTests.cs +++ b/Tests/AssemblyWithBaseInDifferentModuleTests.cs @@ -155,14 +155,14 @@ public void GenericBase_MultipleBaseClasses_GenericArgsMapping_BaseHasMoreArgs() Assert.True(instance.Property2.StaticEqualsCalled); instance.Property2.StaticEqualsCalled = false; } - + [Fact] public void ClassWithGenericTypeInInheritanceChainUsesCorrectEventInvoker() { // Issue #477 - + Weave(false); - + using (var module = ModuleDefinition.ReadModule(testResult.AssemblyPath)) { var typeDef = module.GetType(nameof(ClassWithGenericMiddleChildInDifferentModule)); diff --git a/Tests/AttributeReaders/DependsOnDataAttributeReaderTests.cs b/Tests/AttributeReaders/DependsOnDataAttributeReaderTests.cs index 252aae02..7122eafb 100644 --- a/Tests/AttributeReaders/DependsOnDataAttributeReaderTests.cs +++ b/Tests/AttributeReaders/DependsOnDataAttributeReaderTests.cs @@ -33,12 +33,12 @@ public class Person [Fact] public void PropertyThatDoesNotExist() { - var reader = new ModuleWeaver(); + var weaver = new ModuleWeaver(); var node = new TypeNode { TypeDefinition = DefinitionFinder.FindType(), }; - reader.ProcessDependsOnAttributes(node); + weaver.ProcessDependsOnAttributes(node); //TODO: should raise an exception //logger.Received().LogError("Could not find property 'NotAProperty2' for DependsOnAttribute assigned to 'FullName'."); //logger.Received().LogError("Could not find property 'NotAProperty1' for DependsOnAttribute assigned to 'FullName'."); diff --git a/Tests/DefinitionFinder.cs b/Tests/DefinitionFinder.cs index 0dfb5f5e..3dfb0307 100644 --- a/Tests/DefinitionFinder.cs +++ b/Tests/DefinitionFinder.cs @@ -65,6 +65,6 @@ static TypeDefinition FindType(Type typeToFind) } } } - throw new Exception(); + throw new(); } } diff --git a/Tests/InjectOnPropertyNameChangedTests.cs b/Tests/InjectOnPropertyNameChangedTests.cs index 4bf32c34..1aedc26a 100644 --- a/Tests/InjectOnPropertyNameChangedTests.cs +++ b/Tests/InjectOnPropertyNameChangedTests.cs @@ -16,7 +16,7 @@ public Task ModuleWeaver_WhenInjectOnPropertyNameChangedIsTrue_WarnsForNonVoidMe }; var result = moduleWeaver.ExecuteTestRun( - "AssemblyWithNonVoidOnPropertyNameChanged.dll", + "AssemblyWithNonVoidOnPropertyNameChanged.dll", assemblyName: "AssemblyWithNonVoidOnPropertyNameChanged_Warn", ignoreCodes: new[] {"0x80131869"}); return Verifier.Verify(result.Warnings.Single().Text); diff --git a/Tests/MethodFinderTest.cs b/Tests/MethodFinderTest.cs index 7da236a8..c511b688 100644 --- a/Tests/MethodFinderTest.cs +++ b/Tests/MethodFinderTest.cs @@ -12,10 +12,10 @@ public MethodFinderTest() { var location = typeof(MethodFinderTest).Assembly.Location; var module = ModuleDefinition.ReadModule(location); - methodFinder = new ModuleWeaver - { - ModuleDefinition = module - }; + methodFinder = new() + { + ModuleDefinition = module + }; typeDefinition = module.Types.First(x => x.Name.EndsWith("MethodFinderTest")); } @@ -95,9 +95,8 @@ public void NoMethodTest() Assert.Null(methodFinder.RecursiveFindEventInvoker(definitionToProcess)); } - public class NoMethod - { - } + public class NoMethod; + [Fact] public void NoParamsTest() { diff --git a/Tests/MethodInjectorTests.cs b/Tests/MethodInjectorTests.cs index e35f18aa..e1a6fc7a 100644 --- a/Tests/MethodInjectorTests.cs +++ b/Tests/MethodInjectorTests.cs @@ -7,14 +7,6 @@ [SuppressMessage("ReSharper", "DelegateSubtraction")] public class MethodInjectorTests { - public MethodInjectorTests() - { - methodInjector = new ModuleWeaver - { - ModuleDefinition = ModuleDefinition.ReadModule(typeof(MethodInjectorTests).Assembly.Location) - }; - } - [Fact] public void ShouldFindCorrectHandlerFieldInDefaultImpl() { @@ -101,7 +93,10 @@ public void ShouldNotFindAmbiguousField() Assert.Null(field); } - ModuleWeaver methodInjector; + ModuleWeaver methodInjector = new() + { + ModuleDefinition = ModuleDefinition.ReadModule(typeof(MethodInjectorTests).Assembly.Location) + }; #pragma warning disable CS0067, CS0169, CS0649 class ClassWithMultipleHandlerFieldsDefaultImpl : diff --git a/Tests/PropertyInfoCheckers/AbstractInfoCheckerTest.cs b/Tests/PropertyInfoCheckers/AbstractInfoCheckerTest.cs index 3459f7ea..c3d912c4 100644 --- a/Tests/PropertyInfoCheckers/AbstractInfoCheckerTest.cs +++ b/Tests/PropertyInfoCheckers/AbstractInfoCheckerTest.cs @@ -6,26 +6,34 @@ public class AbstractInfoCheckerTest [Fact] public void IsAbstract() { - var checker = new ModuleWeaver(); + var weaver = new ModuleWeaver(); var propertyDefinition = DefinitionFinder.FindType() .Properties .First(x => x.Name == "AbstractProperty"); - var message = checker.CheckForWarning(new PropertyData - {PropertyDefinition = propertyDefinition,}, InvokerTypes.String); + var message = weaver.CheckForWarning( + new() + { + PropertyDefinition = propertyDefinition, + }, + InvokerTypes.String); Assert.NotNull(message); } [Fact] public void NonAbstract() { - var checker = new ModuleWeaver(); + var weaver = new ModuleWeaver(); var propertyDefinition = DefinitionFinder.FindType() .Properties .First(x => x.Name == "NonAbstractProperty"); - var message = checker.CheckForWarning(new PropertyData - {PropertyDefinition = propertyDefinition,}, InvokerTypes.String); + var message = weaver.CheckForWarning( + new() + { + PropertyDefinition = propertyDefinition, + }, + InvokerTypes.String); Assert.Null(message); } diff --git a/Tests/PropertyInfoCheckers/BeforeAfterWithNoGetInfoCheckerTest.cs b/Tests/PropertyInfoCheckers/BeforeAfterWithNoGetInfoCheckerTest.cs index c9bcce97..14ed8eb5 100644 --- a/Tests/PropertyInfoCheckers/BeforeAfterWithNoGetInfoCheckerTest.cs +++ b/Tests/PropertyInfoCheckers/BeforeAfterWithNoGetInfoCheckerTest.cs @@ -11,10 +11,12 @@ public void WithGet() var propertyDefinition = DefinitionFinder.FindProperty("PropertyWithGet"); - var message = checker.CheckForWarning(new PropertyData - { - PropertyDefinition = propertyDefinition, - }, InvokerTypes.BeforeAfter); + var message = checker.CheckForWarning( + new() + { + PropertyDefinition = propertyDefinition, + }, + InvokerTypes.BeforeAfter); Assert.Null(message); } @@ -25,10 +27,12 @@ public void NoGet() var propertyDefinition = DefinitionFinder.FindProperty("PropertyNoGet"); - var message = checker.CheckForWarning(new PropertyData - { - PropertyDefinition = propertyDefinition, - }, InvokerTypes.BeforeAfter); + var message = checker.CheckForWarning( + new() + { + PropertyDefinition = propertyDefinition, + }, + InvokerTypes.BeforeAfter); Assert.NotNull(message); } diff --git a/Tests/PropertyInfoCheckers/CheckForEqualityWithNoBackingFieldSetInfoCheckerTest.cs b/Tests/PropertyInfoCheckers/CheckForEqualityWithNoBackingFieldSetInfoCheckerTest.cs index d0589693..3a6d9de6 100644 --- a/Tests/PropertyInfoCheckers/CheckForEqualityWithNoBackingFieldSetInfoCheckerTest.cs +++ b/Tests/PropertyInfoCheckers/CheckForEqualityWithNoBackingFieldSetInfoCheckerTest.cs @@ -7,30 +7,34 @@ public class CheckForEqualityWithNoBackingFieldSetInfoCheckerTest [Fact] public void WithBackingField() { - var checker = new ModuleWeaver(); + var weaver = new ModuleWeaver(); var propertyDefinition = DefinitionFinder.FindProperty(() => WithBackingFieldProperty); - var warning = checker.CheckForWarning(new PropertyData - { - PropertyDefinition = propertyDefinition, - BackingFieldReference = propertyDefinition.DeclaringType.Fields[0] - }, InvokerTypes.String); + var warning = weaver.CheckForWarning( + new() + { + PropertyDefinition = propertyDefinition, + BackingFieldReference = propertyDefinition.DeclaringType.Fields[0] + }, + InvokerTypes.String); Assert.Null(warning); } [Fact] public void WithoutBackingField() { - var checker = new ModuleWeaver(); + var weaver = new ModuleWeaver(); var propertyDefinition = DefinitionFinder.FindProperty("WithoutBackingFieldProperty"); - var warning = checker.CheckForWarning(new PropertyData - { - PropertyDefinition = propertyDefinition, - BackingFieldReference = null, - }, InvokerTypes.String); + var warning = weaver.CheckForWarning( + new() + { + PropertyDefinition = propertyDefinition, + BackingFieldReference = null, + }, + InvokerTypes.String); Assert.NotNull(warning); } diff --git a/Tests/PropertyInfoCheckers/IndexerCheckerTest.cs b/Tests/PropertyInfoCheckers/IndexerCheckerTest.cs index 29d68e2a..66828ebc 100644 --- a/Tests/PropertyInfoCheckers/IndexerCheckerTest.cs +++ b/Tests/PropertyInfoCheckers/IndexerCheckerTest.cs @@ -2,13 +2,12 @@ using Xunit; // ReSharper disable ValueParameterNotUsed - public class IndexerCheckerTest { [Fact] public void IsIndexer() { - var checker = new ModuleWeaver(); + var weaver = new ModuleWeaver(); var propertyDefinition = DefinitionFinder.FindType() .Properties .First(); @@ -17,7 +16,7 @@ public void IsIndexer() { PropertyDefinition = propertyDefinition, }; - var message = checker.CheckForWarning(propertyData, InvokerTypes.String); + var message = weaver.CheckForWarning(propertyData, InvokerTypes.String); Assert.Equal("Property is an indexer.", message); } diff --git a/Tests/PropertyInfoCheckers/PropertyChangedArgWithNoGetInfoCheckerTest.cs b/Tests/PropertyInfoCheckers/PropertyChangedArgWithNoGetInfoCheckerTest.cs index 4910de92..b6daa5e4 100644 --- a/Tests/PropertyInfoCheckers/PropertyChangedArgWithNoGetInfoCheckerTest.cs +++ b/Tests/PropertyInfoCheckers/PropertyChangedArgWithNoGetInfoCheckerTest.cs @@ -8,28 +8,32 @@ public class PropertyChangedArgWithNoGetInfoCheckerTest [Fact] public void WithGet() { - var checker = new ModuleWeaver(); + var weaver = new ModuleWeaver(); var propertyDefinition = DefinitionFinder.FindProperty("PropertyWithGet"); - var message = checker.CheckForWarning(new PropertyData - { - PropertyDefinition = propertyDefinition, - }, InvokerTypes.PropertyChangedArg); + var message = weaver.CheckForWarning( + new() + { + PropertyDefinition = propertyDefinition, + }, + InvokerTypes.PropertyChangedArg); Assert.Null(message); } [Fact] public void NoGet() { - var checker = new ModuleWeaver(); + var weaver = new ModuleWeaver(); var propertyDefinition = DefinitionFinder.FindProperty("PropertyNoGet"); - var message = checker.CheckForWarning(new PropertyData - { - PropertyDefinition = propertyDefinition, - }, InvokerTypes.PropertyChangedArg); + var message = weaver.CheckForWarning( + new() + { + PropertyDefinition = propertyDefinition, + }, + InvokerTypes.PropertyChangedArg); Assert.NotNull(message); } diff --git a/Tests/StackOverflowCheckerTests.cs b/Tests/StackOverflowCheckerTests.cs index 4749eb52..9e744e04 100644 --- a/Tests/StackOverflowCheckerTests.cs +++ b/Tests/StackOverflowCheckerTests.cs @@ -4,12 +4,7 @@ public class StackOverflowCheckerTests { - ModuleWeaver stackOverflowChecker; - - public StackOverflowCheckerTests() - { - stackOverflowChecker = new ModuleWeaver(); - } + ModuleWeaver stackOverflowChecker = new(); [Fact] public void CanDetectStackOverflow() diff --git a/Tests/TriggerDependentPropertiesConfigTests.cs b/Tests/TriggerDependentPropertiesConfigTests.cs index 6843b4a8..133f0cb8 100644 --- a/Tests/TriggerDependentPropertiesConfigTests.cs +++ b/Tests/TriggerDependentPropertiesConfigTests.cs @@ -7,25 +7,31 @@ public class TriggerDependentPropertiesConfigTests public void False() { var xElement = XElement.Parse(""); - var moduleWeaver = new ModuleWeaver {Config = xElement}; - moduleWeaver.ResolveTriggerDependentPropertiesConfig(); - Assert.False(moduleWeaver.TriggerDependentProperties); + var weaver = new ModuleWeaver + { + Config = xElement + }; + weaver.ResolveTriggerDependentPropertiesConfig(); + Assert.False(weaver.TriggerDependentProperties); } [Fact] public void True() { var xElement = XElement.Parse(""); - var moduleWeaver = new ModuleWeaver {Config = xElement}; - moduleWeaver.ResolveTriggerDependentPropertiesConfig(); - Assert.True(moduleWeaver.TriggerDependentProperties); + var weaver = new ModuleWeaver + { + Config = xElement + }; + weaver.ResolveTriggerDependentPropertiesConfig(); + Assert.True(weaver.TriggerDependentProperties); } [Fact] public void Default() { - var moduleWeaver = new ModuleWeaver(); - moduleWeaver.ResolveOnPropertyNameChangedConfig(); - Assert.True(moduleWeaver.TriggerDependentProperties); + var weaver = new ModuleWeaver(); + weaver.ResolveOnPropertyNameChangedConfig(); + Assert.True(weaver.TriggerDependentProperties); } } \ No newline at end of file