From 59c6dbbaaf9bc01bc85b86c7cd5057d843de44c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Wed, 3 May 2017 21:56:18 +0200 Subject: [PATCH 001/118] Added .NET Core and .NET Standard projects - closes #12, removed unused references, version bumped to 1.2.2, minor changes --- .../NotifyPropertyChangedBase.Net40.csproj | 6 --- .../NotifyPropertyChangedBase.Net45.csproj | 7 ---- .../NotifyPropertyChangedBase.NetCore.csproj | 17 +++++++++ ...tifyPropertyChangedBase.NetStandard.csproj | 19 ++++++++++ .../NotifyPropertyChangedBase.Uap.rd.xml | 11 +++++- NotifyPropertyChangedBase.nuspec | 8 ++++ NotifyPropertyChangedBase.sln | 38 ++++++++++++++++++- NotifyPropertyChangedBase/Helpers.cs | 19 ++++++++-- .../NotifyPropertyChanged.cs | 17 ++++----- appveyor.yml | 8 ++-- 10 files changed, 117 insertions(+), 33 deletions(-) create mode 100644 NotifyPropertyChangedBase.NetCore/NotifyPropertyChangedBase.NetCore.csproj create mode 100644 NotifyPropertyChangedBase.NetStandard/NotifyPropertyChangedBase.NetStandard.csproj diff --git a/NotifyPropertyChangedBase.Net40/NotifyPropertyChangedBase.Net40.csproj b/NotifyPropertyChangedBase.Net40/NotifyPropertyChangedBase.Net40.csproj index b66d423..58cc601 100644 --- a/NotifyPropertyChangedBase.Net40/NotifyPropertyChangedBase.Net40.csproj +++ b/NotifyPropertyChangedBase.Net40/NotifyPropertyChangedBase.Net40.csproj @@ -33,12 +33,6 @@ - - - - - - diff --git a/NotifyPropertyChangedBase.Net45/NotifyPropertyChangedBase.Net45.csproj b/NotifyPropertyChangedBase.Net45/NotifyPropertyChangedBase.Net45.csproj index 29ab047..2149569 100644 --- a/NotifyPropertyChangedBase.Net45/NotifyPropertyChangedBase.Net45.csproj +++ b/NotifyPropertyChangedBase.Net45/NotifyPropertyChangedBase.Net45.csproj @@ -33,13 +33,6 @@ - - - - - - - diff --git a/NotifyPropertyChangedBase.NetCore/NotifyPropertyChangedBase.NetCore.csproj b/NotifyPropertyChangedBase.NetCore/NotifyPropertyChangedBase.NetCore.csproj new file mode 100644 index 0000000..83695eb --- /dev/null +++ b/NotifyPropertyChangedBase.NetCore/NotifyPropertyChangedBase.NetCore.csproj @@ -0,0 +1,17 @@ + + + + netcoreapp1.0 + NotifyPropertyChangedBase + 1.0.0 + An easy to use base class that helps you implement the INotifyPropertyChanged interface. + © 2017 Marian Dolinský + NotifyPropertyChangedBase + Marian Dolinský + Marian Dolinský + NotifyPropertyChangedBase + + + + + \ No newline at end of file diff --git a/NotifyPropertyChangedBase.NetStandard/NotifyPropertyChangedBase.NetStandard.csproj b/NotifyPropertyChangedBase.NetStandard/NotifyPropertyChangedBase.NetStandard.csproj new file mode 100644 index 0000000..c7e2a19 --- /dev/null +++ b/NotifyPropertyChangedBase.NetStandard/NotifyPropertyChangedBase.NetStandard.csproj @@ -0,0 +1,19 @@ + + + + netstandard1.0 + NotifyPropertyChangedBase + 1.0.0 + An easy to use base class that helps you implement the INotifyPropertyChanged interface. + NotifyPropertyChangedBase + © 2017 Marian Dolinský + NotifyPropertyChangedBase + Marian Dolinský + Marian Dolinský + 1.0.0.0 + 1.0.0.0 + + + + + \ No newline at end of file diff --git a/NotifyPropertyChangedBase.Uap/Properties/NotifyPropertyChangedBase.Uap.rd.xml b/NotifyPropertyChangedBase.Uap/Properties/NotifyPropertyChangedBase.Uap.rd.xml index b96d6d3..53dd32c 100644 --- a/NotifyPropertyChangedBase.Uap/Properties/NotifyPropertyChangedBase.Uap.rd.xml +++ b/NotifyPropertyChangedBase.Uap/Properties/NotifyPropertyChangedBase.Uap.rd.xml @@ -31,7 +31,16 @@ - + + + + + + + + + + diff --git a/NotifyPropertyChangedBase.nuspec b/NotifyPropertyChangedBase.nuspec index d501519..9e2bfd9 100644 --- a/NotifyPropertyChangedBase.nuspec +++ b/NotifyPropertyChangedBase.nuspec @@ -20,11 +20,19 @@ + + + + + + + + \ No newline at end of file diff --git a/NotifyPropertyChangedBase.sln b/NotifyPropertyChangedBase.sln index 6064327..89b788a 100644 --- a/NotifyPropertyChangedBase.sln +++ b/NotifyPropertyChangedBase.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26403.3 +VisualStudioVersion = 15.0.26403.7 MinimumVisualStudioVersion = 10.0.40219.1 Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "NotifyPropertyChangedBase", "NotifyPropertyChangedBase\NotifyPropertyChangedBase.shproj", "{036F1706-A135-46EA-A881-C2B334E9936D}" EndProject @@ -23,6 +23,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotifyPropertyChangedBase.N EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotifyPropertyChangedBase.Uap", "NotifyPropertyChangedBase.Uap\NotifyPropertyChangedBase.Uap.csproj", "{25F76EE1-678A-4247-9697-5E5DAD3BB76E}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotifyPropertyChangedBase.NetCore", "NotifyPropertyChangedBase.NetCore\NotifyPropertyChangedBase.NetCore.csproj", "{8917A083-31A8-4954-8656-99385FF09237}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotifyPropertyChangedBase.NetStandard", "NotifyPropertyChangedBase.NetStandard\NotifyPropertyChangedBase.NetStandard.csproj", "{A053E7BD-A78E-4C4C-A5FB-141C34DA8159}" +EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution NotifyPropertyChangedBase\NotifyPropertyChangedBase.projitems*{036f1706-a135-46ea-a881-c2b334e9936d}*SharedItemsImports = 13 @@ -89,6 +93,38 @@ Global {25F76EE1-678A-4247-9697-5E5DAD3BB76E}.Release|x64.Build.0 = Release|x64 {25F76EE1-678A-4247-9697-5E5DAD3BB76E}.Release|x86.ActiveCfg = Release|x86 {25F76EE1-678A-4247-9697-5E5DAD3BB76E}.Release|x86.Build.0 = Release|x86 + {8917A083-31A8-4954-8656-99385FF09237}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8917A083-31A8-4954-8656-99385FF09237}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8917A083-31A8-4954-8656-99385FF09237}.Debug|ARM.ActiveCfg = Debug|Any CPU + {8917A083-31A8-4954-8656-99385FF09237}.Debug|ARM.Build.0 = Debug|Any CPU + {8917A083-31A8-4954-8656-99385FF09237}.Debug|x64.ActiveCfg = Debug|Any CPU + {8917A083-31A8-4954-8656-99385FF09237}.Debug|x64.Build.0 = Debug|Any CPU + {8917A083-31A8-4954-8656-99385FF09237}.Debug|x86.ActiveCfg = Debug|Any CPU + {8917A083-31A8-4954-8656-99385FF09237}.Debug|x86.Build.0 = Debug|Any CPU + {8917A083-31A8-4954-8656-99385FF09237}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8917A083-31A8-4954-8656-99385FF09237}.Release|Any CPU.Build.0 = Release|Any CPU + {8917A083-31A8-4954-8656-99385FF09237}.Release|ARM.ActiveCfg = Release|Any CPU + {8917A083-31A8-4954-8656-99385FF09237}.Release|ARM.Build.0 = Release|Any CPU + {8917A083-31A8-4954-8656-99385FF09237}.Release|x64.ActiveCfg = Release|Any CPU + {8917A083-31A8-4954-8656-99385FF09237}.Release|x64.Build.0 = Release|Any CPU + {8917A083-31A8-4954-8656-99385FF09237}.Release|x86.ActiveCfg = Release|Any CPU + {8917A083-31A8-4954-8656-99385FF09237}.Release|x86.Build.0 = Release|Any CPU + {A053E7BD-A78E-4C4C-A5FB-141C34DA8159}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A053E7BD-A78E-4C4C-A5FB-141C34DA8159}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A053E7BD-A78E-4C4C-A5FB-141C34DA8159}.Debug|ARM.ActiveCfg = Debug|Any CPU + {A053E7BD-A78E-4C4C-A5FB-141C34DA8159}.Debug|ARM.Build.0 = Debug|Any CPU + {A053E7BD-A78E-4C4C-A5FB-141C34DA8159}.Debug|x64.ActiveCfg = Debug|Any CPU + {A053E7BD-A78E-4C4C-A5FB-141C34DA8159}.Debug|x64.Build.0 = Debug|Any CPU + {A053E7BD-A78E-4C4C-A5FB-141C34DA8159}.Debug|x86.ActiveCfg = Debug|Any CPU + {A053E7BD-A78E-4C4C-A5FB-141C34DA8159}.Debug|x86.Build.0 = Debug|Any CPU + {A053E7BD-A78E-4C4C-A5FB-141C34DA8159}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A053E7BD-A78E-4C4C-A5FB-141C34DA8159}.Release|Any CPU.Build.0 = Release|Any CPU + {A053E7BD-A78E-4C4C-A5FB-141C34DA8159}.Release|ARM.ActiveCfg = Release|Any CPU + {A053E7BD-A78E-4C4C-A5FB-141C34DA8159}.Release|ARM.Build.0 = Release|Any CPU + {A053E7BD-A78E-4C4C-A5FB-141C34DA8159}.Release|x64.ActiveCfg = Release|Any CPU + {A053E7BD-A78E-4C4C-A5FB-141C34DA8159}.Release|x64.Build.0 = Release|Any CPU + {A053E7BD-A78E-4C4C-A5FB-141C34DA8159}.Release|x86.ActiveCfg = Release|Any CPU + {A053E7BD-A78E-4C4C-A5FB-141C34DA8159}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/NotifyPropertyChangedBase/Helpers.cs b/NotifyPropertyChangedBase/Helpers.cs index bb96936..f9a5b90 100644 --- a/NotifyPropertyChangedBase/Helpers.cs +++ b/NotifyPropertyChangedBase/Helpers.cs @@ -1,5 +1,5 @@ using System; -#if WINDOWS_UWP +#if!NET_40 using System.Reflection; #endif @@ -7,7 +7,7 @@ namespace NotifyPropertyChangedBase { internal static class Helpers { - internal static void ValidateNotNull(object obj, string parameterName) + internal static void ValidateObjectNotNull(object obj, string parameterName) { if (obj == null) { @@ -15,7 +15,7 @@ internal static void ValidateNotNull(object obj, string parameterName) } } - internal static void ValidateNotNullOrWhiteSpace(string str, string parameterName) + internal static void ValidateStringNotNullOrWhiteSpace(string str, string parameterName) { if (string.IsNullOrWhiteSpace(str)) { @@ -23,12 +23,23 @@ internal static void ValidateNotNullOrWhiteSpace(string str, string parameterNam } } + // Make changes in the NotifyPropertyChangedBase.Uap.rd file if you change something with the 'type' parameter internal static bool GetIsValueType(this Type type) { -#if WINDOWS_UWP +#if !NET_40 return type.GetTypeInfo().IsValueType; #else return type.IsValueType; +#endif + } + + // Make changes in the NotifyPropertyChangedBase.Uap.rd file if you change something with the 'secondType' parameter + internal static bool GetIsAssignableFrom(this Type type, Type secondType) + { +#if !NET_40 + return type.GetTypeInfo().IsAssignableFrom(secondType.GetTypeInfo()); +#else + return type.IsAssignableFrom(secondType); #endif } } diff --git a/NotifyPropertyChangedBase/NotifyPropertyChanged.cs b/NotifyPropertyChangedBase/NotifyPropertyChanged.cs index 5d7dbef..53b3203 100644 --- a/NotifyPropertyChangedBase/NotifyPropertyChanged.cs +++ b/NotifyPropertyChangedBase/NotifyPropertyChanged.cs @@ -1,9 +1,6 @@ using System; using System.Collections.Generic; using System.ComponentModel; -#if WINDOWS_UWP -using System.Reflection; -#endif #if !NET_40 using System.Runtime.CompilerServices; #endif @@ -90,8 +87,8 @@ protected void RegisterProperty(string name, Type type, object defaultValue) // Make changes in the NotifyPropertyChangedBase.Uap.rd file if you change something with the 'type' parameter protected void RegisterProperty(string name, Type type, object defaultValue, PropertyChangedCallbackHandler propertyChangedCallback) { - Helpers.ValidateNotNullOrWhiteSpace(name, nameof(name)); - Helpers.ValidateNotNull(type, nameof(type)); + Helpers.ValidateStringNotNullOrWhiteSpace(name, nameof(name)); + Helpers.ValidateObjectNotNull(type, nameof(type)); ValidateValueForType(defaultValue, type); if (backingStore.ContainsKey(name)) @@ -120,7 +117,7 @@ protected void RegisterProperty(string name, Type type, object defaultValue, Pro /// protected void RegisterPropertyChangedCallback(string propertyName, PropertyChangedCallbackHandler propertyChangedCallback) { - Helpers.ValidateNotNull(propertyChangedCallback, nameof(propertyChangedCallback)); + Helpers.ValidateObjectNotNull(propertyChangedCallback, nameof(propertyChangedCallback)); GetPropertyData(propertyName, nameof(propertyName)).PropertyChangedCallback += propertyChangedCallback; } @@ -142,7 +139,7 @@ protected void RegisterPropertyChangedCallback(string propertyName, PropertyChan /// protected void UnregisterPropertyChangedCallback(string propertyName, PropertyChangedCallbackHandler propertyChangedCallback) { - Helpers.ValidateNotNull(propertyChangedCallback, nameof(propertyChangedCallback)); + Helpers.ValidateObjectNotNull(propertyChangedCallback, nameof(propertyChangedCallback)); GetPropertyData(propertyName, nameof(propertyName)).PropertyChangedCallback -= propertyChangedCallback; } @@ -257,7 +254,7 @@ protected void OnPropertyChanged(string propertyName) protected void OnPropertyChanged([CallerMemberName]string propertyName = null) #endif { - Helpers.ValidateNotNullOrWhiteSpace(propertyName, nameof(propertyName)); + Helpers.ValidateStringNotNullOrWhiteSpace(propertyName, nameof(propertyName)); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } @@ -272,7 +269,7 @@ private void ValidateValueForType(object value, Type type) } else { - if (!type.IsAssignableFrom(value.GetType())) + if (!type.GetIsAssignableFrom(value.GetType())) { throw new ArgumentException($"The specified value cannot be assigned to a property of type ({type})"); } @@ -281,7 +278,7 @@ private void ValidateValueForType(object value, Type type) private PropertyData GetPropertyData(string propertyName, string propertyNameParameterName) { - Helpers.ValidateNotNullOrWhiteSpace(propertyName, propertyNameParameterName); + Helpers.ValidateStringNotNullOrWhiteSpace(propertyName, propertyNameParameterName); if (!backingStore.ContainsKey(propertyName)) { diff --git a/appveyor.yml b/appveyor.yml index eb30bea..374b66c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: 1.2.1-{branch}{build} +version: 1.2.2-{branch}{build} pull_requests: do_not_increment_build_number: true branches: @@ -17,9 +17,9 @@ configuration: Release assembly_info: patch: true file: SharedAssemblyInfo.cs - assembly_version: 1.2.1.{build} - assembly_file_version: 1.2.1.{build} - assembly_informational_version: 1.2.1.{build} + assembly_version: 1.2.2.{build} + assembly_file_version: 1.2.2.{build} + assembly_informational_version: 1.2.2.{build} before_build: - ps: >- Start-FileDownload "https://dist.nuget.org/win-x86-commandline/v4.1.0/nuget.exe" From a0181f2fb91d208e103d38c053246fcd6034ce27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Wed, 3 May 2017 22:11:45 +0200 Subject: [PATCH 002/118] Upgraded to Microsoft.NETCore.UniversalWindowsPlatform v5.3.3 --- .../NotifyPropertyChangedBase.Uap.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NotifyPropertyChangedBase.Uap/NotifyPropertyChangedBase.Uap.csproj b/NotifyPropertyChangedBase.Uap/NotifyPropertyChangedBase.Uap.csproj index f913dff..ffdbb17 100644 --- a/NotifyPropertyChangedBase.Uap/NotifyPropertyChangedBase.Uap.csproj +++ b/NotifyPropertyChangedBase.Uap/NotifyPropertyChangedBase.Uap.csproj @@ -122,7 +122,7 @@ - 5.3.2 + 5.3.3 From cae5d96b75111eefe0e6d5715c18bd36546853c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 4 May 2017 15:01:06 +0200 Subject: [PATCH 003/118] Maybe improved AfterBuild script --- AfterBuild.ps1 | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/AfterBuild.ps1 b/AfterBuild.ps1 index f1b208b..6709eca 100644 --- a/AfterBuild.ps1 +++ b/AfterBuild.ps1 @@ -7,11 +7,20 @@ foreach ($projectFolder in $projectFolders) { $releaseFolder = Join-Path $projectFolder.FullName "\bin\Release" - if (!(Test-Path $releaseFolder)) + if (Test-Path "$releaseFolder\netcoreapp1.0") + { + $releaseFolder = Join-Path $releaseFolder "\netcoreapp1.0" + } + elseif (Test-Path "$releaseFolder\netstandard1.0") { - continue; + $releaseFolder = Join-Path $releaseFolder "\netstandard1.0" } + if (!(Test-Path $releaseFolder)) + { + throw "Invalid project release folder. `$releaseFolder: '$releaseFolder'" + } + $zipFileName = "$projectFolder.$env:APPVEYOR_BUILD_VERSION.zip" 7z a $zipFileName "$releaseFolder\*" From 7fc0944331c3c59f27e841a6171b1c3127f98aa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 4 May 2017 15:48:59 +0200 Subject: [PATCH 004/118] Fixed the build maybee --- AfterBuild.ps1 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/AfterBuild.ps1 b/AfterBuild.ps1 index 6709eca..66dfb1d 100644 --- a/AfterBuild.ps1 +++ b/AfterBuild.ps1 @@ -5,6 +5,12 @@ $projectFolders = Get-ChildItem -Directory -Filter "NotifyPropertyChangedBase*" foreach ($projectFolder in $projectFolders) { + # Skip the Shared project + if ($projectFolder -eq "NotifyPropertyChangedBase") + { + continue; + } + $releaseFolder = Join-Path $projectFolder.FullName "\bin\Release" if (Test-Path "$releaseFolder\netcoreapp1.0") From d31b02c44a1370e64faa8c590e3fde7cc3937225 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 4 May 2017 20:50:37 +0200 Subject: [PATCH 005/118] Much better ^^ --- AfterBuild.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AfterBuild.ps1 b/AfterBuild.ps1 index 66dfb1d..f8f8cad 100644 --- a/AfterBuild.ps1 +++ b/AfterBuild.ps1 @@ -6,7 +6,7 @@ $projectFolders = Get-ChildItem -Directory -Filter "NotifyPropertyChangedBase*" foreach ($projectFolder in $projectFolders) { # Skip the Shared project - if ($projectFolder -eq "NotifyPropertyChangedBase") + if ($projectFolder.Name -eq "NotifyPropertyChangedBase") { continue; } From 8163dc97395d57115bafc3db5416595f901b3603 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 4 May 2017 22:49:27 +0200 Subject: [PATCH 006/118] Updated appveyor.yml, somewhow reverted the previous commit [skip ci] --- appveyor.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index 374b66c..7bb7488 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -25,6 +25,13 @@ before_build: Start-FileDownload "https://dist.nuget.org/win-x86-commandline/v4.1.0/nuget.exe" .\nuget restore + + + if($LastExitCode -ne 0) + + { + $host.SetShouldExit($LastExitCode) + } build: verbosity: minimal after_build: From d05ac42047a916a84261a716baf21d95ff268aaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Fri, 5 May 2017 22:31:22 +0200 Subject: [PATCH 007/118] Fixed nuspec dependency --- NotifyPropertyChangedBase.nuspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NotifyPropertyChangedBase.nuspec b/NotifyPropertyChangedBase.nuspec index 9e2bfd9..0eae115 100644 --- a/NotifyPropertyChangedBase.nuspec +++ b/NotifyPropertyChangedBase.nuspec @@ -18,7 +18,7 @@ - + From 21d645ee1d90eb75f2dfd8ac5511c5810cde9884 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Sun, 28 May 2017 21:55:07 +0200 Subject: [PATCH 008/118] Fixed MyGet versioning --- BeforeBuild.ps1 | 10 ++++++++++ NotifyPropertyChangedBase.sln | 3 ++- appveyor.yml | 12 +----------- 3 files changed, 13 insertions(+), 12 deletions(-) create mode 100644 BeforeBuild.ps1 diff --git a/BeforeBuild.ps1 b/BeforeBuild.ps1 new file mode 100644 index 0000000..91ceb07 --- /dev/null +++ b/BeforeBuild.ps1 @@ -0,0 +1,10 @@ +Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildScripts/master/Scripts/Set-BuildVersion.ps1" +.\Set-BuildVersion.ps1 + +Start-FileDownload "https://dist.nuget.org/win-x86-commandline/v4.1.0/nuget.exe" +.\nuget restore + +if($LastExitCode -ne 0) +{ + $host.SetShouldExit($LastExitCode) +} diff --git a/NotifyPropertyChangedBase.sln b/NotifyPropertyChangedBase.sln index 89b788a..270d20e 100644 --- a/NotifyPropertyChangedBase.sln +++ b/NotifyPropertyChangedBase.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26403.7 +VisualStudioVersion = 15.0.26430.6 MinimumVisualStudioVersion = 10.0.40219.1 Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "NotifyPropertyChangedBase", "NotifyPropertyChangedBase\NotifyPropertyChangedBase.shproj", "{036F1706-A135-46EA-A881-C2B334E9936D}" EndProject @@ -11,6 +11,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution .gitignore = .gitignore AfterBuild.ps1 = AfterBuild.ps1 appveyor.yml = appveyor.yml + BeforeBuild.ps1 = BeforeBuild.ps1 LICENSE.md = LICENSE.md NotifyPropertyChangedBase.nuspec = NotifyPropertyChangedBase.nuspec README.md = README.md diff --git a/appveyor.yml b/appveyor.yml index 7bb7488..ac6a00f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -21,17 +21,7 @@ assembly_info: assembly_file_version: 1.2.2.{build} assembly_informational_version: 1.2.2.{build} before_build: -- ps: >- - Start-FileDownload "https://dist.nuget.org/win-x86-commandline/v4.1.0/nuget.exe" - - .\nuget restore - - - if($LastExitCode -ne 0) - - { - $host.SetShouldExit($LastExitCode) - } +- ps: '& .\BeforeBuild.ps1' build: verbosity: minimal after_build: From 83fad476ac70e2151cb233bbcd6dff259da01050 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Wed, 31 May 2017 20:45:36 +0200 Subject: [PATCH 009/118] Added some weird scripting to patch .NET Core and .NET Standard - closes #13 --- BeforeBuild.ps1 | 16 ++++++++++++++++ NotifyPropertyChangedBase.sln | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/BeforeBuild.ps1 b/BeforeBuild.ps1 index 91ceb07..bb787a4 100644 --- a/BeforeBuild.ps1 +++ b/BeforeBuild.ps1 @@ -8,3 +8,19 @@ if($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) } + +# Patch .NET Core and .NET Standard +Install-Module -Name powershell-yaml + +$yaml = Get-Content .\appveyor.yml -Raw +$appveyorConfig = ConvertFrom-Yaml $yaml +$buildVersion = $appveyorConfig.assembly_info.assembly_version.Replace("{build}", $env:APPVEYOR_BUILD_NUMBER) +$csprojs = "NotifyPropertyChangedBase.NetCore", "NotifyPropertyChangedBase.NetStandard" + +foreach ($csproj in $csprojs) +{ + $xml = [xml](Get-Content ".\$csproj\$csproj.csproj") + $propertyGroup = $xml.Project.PropertyGroup + $propertyGroup.Version = $buildVersion + $xml.Save($xmlPath) +} diff --git a/NotifyPropertyChangedBase.sln b/NotifyPropertyChangedBase.sln index 270d20e..14b7eb4 100644 --- a/NotifyPropertyChangedBase.sln +++ b/NotifyPropertyChangedBase.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26430.6 +VisualStudioVersion = 15.0.26430.12 MinimumVisualStudioVersion = 10.0.40219.1 Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "NotifyPropertyChangedBase", "NotifyPropertyChangedBase\NotifyPropertyChangedBase.shproj", "{036F1706-A135-46EA-A881-C2B334E9936D}" EndProject From b7043cf63c68f65c1087c3efcbbefca069b9b606 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Wed, 31 May 2017 21:01:18 +0200 Subject: [PATCH 010/118] I knew that was something weird about him... --- BeforeBuild.ps1 | 16 ++++++++++++---- .../NotifyPropertyChangedBase.NetCore.csproj | 10 ++++++---- .../NotifyPropertyChangedBase.NetStandard.csproj | 8 ++++---- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/BeforeBuild.ps1 b/BeforeBuild.ps1 index bb787a4..017facb 100644 --- a/BeforeBuild.ps1 +++ b/BeforeBuild.ps1 @@ -10,7 +10,7 @@ if($LastExitCode -ne 0) } # Patch .NET Core and .NET Standard -Install-Module -Name powershell-yaml +Install-Module -Name powershell-yaml -Confirm $yaml = Get-Content .\appveyor.yml -Raw $appveyorConfig = ConvertFrom-Yaml $yaml @@ -19,8 +19,16 @@ $csprojs = "NotifyPropertyChangedBase.NetCore", "NotifyPropertyChangedBas foreach ($csproj in $csprojs) { - $xml = [xml](Get-Content ".\$csproj\$csproj.csproj") - $propertyGroup = $xml.Project.PropertyGroup - $propertyGroup.Version = $buildVersion + $xmlPath = "$PSScriptRoot\$csproj\$csproj.csproj" + $xml = [xml](Get-Content $xmlPath) + $propertyGroup = $xml.Project.PropertyGroup + $propertyGroup.Version = $buildVersion + $propertyGroup.AssemblyVersion = $buildVersion + $propertyGroup.FileVersion = $buildVersion $xml.Save($xmlPath) } + +if($LastExitCode -ne 0) +{ + $host.SetShouldExit($LastExitCode) +} diff --git a/NotifyPropertyChangedBase.NetCore/NotifyPropertyChangedBase.NetCore.csproj b/NotifyPropertyChangedBase.NetCore/NotifyPropertyChangedBase.NetCore.csproj index 83695eb..49f4ad1 100644 --- a/NotifyPropertyChangedBase.NetCore/NotifyPropertyChangedBase.NetCore.csproj +++ b/NotifyPropertyChangedBase.NetCore/NotifyPropertyChangedBase.NetCore.csproj @@ -3,13 +3,15 @@ netcoreapp1.0 NotifyPropertyChangedBase - 1.0.0 - An easy to use base class that helps you implement the INotifyPropertyChanged interface. - © 2017 Marian Dolinský NotifyPropertyChangedBase + NotifyPropertyChangedBase + An easy to use base class that helps you implement the INotifyPropertyChanged interface. Marian Dolinský Marian Dolinský - NotifyPropertyChangedBase + © 2017 Marian Dolinský + 1.0.0 + 1.0.0.0 + 1.0.0.0 diff --git a/NotifyPropertyChangedBase.NetStandard/NotifyPropertyChangedBase.NetStandard.csproj b/NotifyPropertyChangedBase.NetStandard/NotifyPropertyChangedBase.NetStandard.csproj index c7e2a19..69f15d0 100644 --- a/NotifyPropertyChangedBase.NetStandard/NotifyPropertyChangedBase.NetStandard.csproj +++ b/NotifyPropertyChangedBase.NetStandard/NotifyPropertyChangedBase.NetStandard.csproj @@ -3,13 +3,13 @@ netstandard1.0 NotifyPropertyChangedBase - 1.0.0 - An easy to use base class that helps you implement the INotifyPropertyChanged interface. NotifyPropertyChangedBase - © 2017 Marian Dolinský NotifyPropertyChangedBase - Marian Dolinský + An easy to use base class that helps you implement the INotifyPropertyChanged interface. Marian Dolinský + Marian Dolinský + © 2017 Marian Dolinský + 1.0.0 1.0.0.0 1.0.0.0 From 1c8e9e5ac950d6fbb62abda49886b5c8227b48d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Wed, 31 May 2017 21:05:40 +0200 Subject: [PATCH 011/118] This one's better in my opinion :) What 'bout yours? --- BeforeBuild.ps1 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/BeforeBuild.ps1 b/BeforeBuild.ps1 index 017facb..deefe9b 100644 --- a/BeforeBuild.ps1 +++ b/BeforeBuild.ps1 @@ -10,7 +10,12 @@ if($LastExitCode -ne 0) } # Patch .NET Core and .NET Standard -Install-Module -Name powershell-yaml -Confirm +Install-Module -Name powershell-yaml -Force + +if($LastExitCode -ne 0) +{ + $host.SetShouldExit($LastExitCode) +} $yaml = Get-Content .\appveyor.yml -Raw $appveyorConfig = ConvertFrom-Yaml $yaml From 7f1230ebe7b5fb2e97d2adcace34114c1d90a6a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Tue, 4 Jul 2017 21:29:35 +0200 Subject: [PATCH 012/118] Minor change [skip ci] --- NotifyPropertyChangedBase/NotifyPropertyChanged.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/NotifyPropertyChangedBase/NotifyPropertyChanged.cs b/NotifyPropertyChangedBase/NotifyPropertyChanged.cs index 53b3203..34ef50e 100644 --- a/NotifyPropertyChangedBase/NotifyPropertyChanged.cs +++ b/NotifyPropertyChangedBase/NotifyPropertyChanged.cs @@ -37,8 +37,8 @@ public abstract class NotifyPropertyChanged : INotifyPropertyChanged /// protected NotifyPropertyChanged() { - IsPropertyChangedCallbackInvokingEnabled = true; - IsPropertyChangedEventInvokingEnabled = true; + IsPropertyChangedCallbackInvokingEnabled = true; + IsPropertyChangedEventInvokingEnabled = true; } /// @@ -279,13 +279,15 @@ private void ValidateValueForType(object value, Type type) private PropertyData GetPropertyData(string propertyName, string propertyNameParameterName) { Helpers.ValidateStringNotNullOrWhiteSpace(propertyName, propertyNameParameterName); - - if (!backingStore.ContainsKey(propertyName)) + + try + { + return backingStore[propertyName]; + } + catch (KeyNotFoundException) { throw new ArgumentException($"There is no registered property called '{propertyName}'.", propertyNameParameterName); } - - return backingStore[propertyName]; } private class PropertyData From d045acbab4f44a3cc7844629964dbb8d78e301e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Wed, 5 Jul 2017 22:16:49 +0200 Subject: [PATCH 013/118] Added unit tests (not finished yet) [skip deployment] --- BeforeBuild.ps1 | 8 +- ...tifyPropertyChangedBase.Tests.Net45.csproj | 76 +++++++++++++++++++ .../Properties/AssemblyInfo.cs | 3 + .../packages.config | 5 ++ ...fyPropertyChangedBase.Tests.NetCore.csproj | 33 ++++++++ .../NotifyPropertyChangedBase.Tests.projitems | 15 ++++ .../NotifyPropertyChangedBase.Tests.shproj | 13 ++++ .../NotifyPropertyChangedTests.cs | 54 +++++++++++++ NotifyPropertyChangedBase.Tests/Wrapper.cs | 59 ++++++++++++++ NotifyPropertyChangedBase.sln | 62 ++++++++++++++- 10 files changed, 321 insertions(+), 7 deletions(-) create mode 100644 NotifyPropertyChangedBase.Tests.Net45/NotifyPropertyChangedBase.Tests.Net45.csproj create mode 100644 NotifyPropertyChangedBase.Tests.Net45/Properties/AssemblyInfo.cs create mode 100644 NotifyPropertyChangedBase.Tests.Net45/packages.config create mode 100644 NotifyPropertyChangedBase.Tests.NetCore/NotifyPropertyChangedBase.Tests.NetCore.csproj create mode 100644 NotifyPropertyChangedBase.Tests/NotifyPropertyChangedBase.Tests.projitems create mode 100644 NotifyPropertyChangedBase.Tests/NotifyPropertyChangedBase.Tests.shproj create mode 100644 NotifyPropertyChangedBase.Tests/NotifyPropertyChangedTests.cs create mode 100644 NotifyPropertyChangedBase.Tests/Wrapper.cs diff --git a/BeforeBuild.ps1 b/BeforeBuild.ps1 index deefe9b..11116eb 100644 --- a/BeforeBuild.ps1 +++ b/BeforeBuild.ps1 @@ -20,16 +20,18 @@ if($LastExitCode -ne 0) $yaml = Get-Content .\appveyor.yml -Raw $appveyorConfig = ConvertFrom-Yaml $yaml $buildVersion = $appveyorConfig.assembly_info.assembly_version.Replace("{build}", $env:APPVEYOR_BUILD_NUMBER) -$csprojs = "NotifyPropertyChangedBase.NetCore", "NotifyPropertyChangedBase.NetStandard" +$projectFolders = Get-ChildItem -Include "*.NetCore","*.NetStandard" -Directory -Recurse -foreach ($csproj in $csprojs) +foreach ($projectFolder in $projectFolders) { - $xmlPath = "$PSScriptRoot\$csproj\$csproj.csproj" + $xmlPath = "$projectFolder.FullName\$projectFolder.Name.csproj" $xml = [xml](Get-Content $xmlPath) $propertyGroup = $xml.Project.PropertyGroup + $propertyGroup.Version = $buildVersion $propertyGroup.AssemblyVersion = $buildVersion $propertyGroup.FileVersion = $buildVersion + $xml.Save($xmlPath) } diff --git a/NotifyPropertyChangedBase.Tests.Net45/NotifyPropertyChangedBase.Tests.Net45.csproj b/NotifyPropertyChangedBase.Tests.Net45/NotifyPropertyChangedBase.Tests.Net45.csproj new file mode 100644 index 0000000..0aa5527 --- /dev/null +++ b/NotifyPropertyChangedBase.Tests.Net45/NotifyPropertyChangedBase.Tests.Net45.csproj @@ -0,0 +1,76 @@ + + + + + Debug + AnyCPU + {7422B848-AB65-4A37-BDB6-FEF98952A0D4} + Library + Properties + NotifyPropertyChangedBase.Tests + NotifyPropertyChangedBase.Tests.Net45 + v4.5 + 512 + {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 15.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages + False + UnitTest + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\MSTest.TestFramework.1.1.18\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll + + + ..\packages\MSTest.TestFramework.1.1.18\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll + + + + + + + Properties\SharedAssemblyInfo.cs + + + + + + + + + {ac23ef0b-d5bd-401e-a074-4072dca935ac} + NotifyPropertyChangedBase.Net45 + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + \ No newline at end of file diff --git a/NotifyPropertyChangedBase.Tests.Net45/Properties/AssemblyInfo.cs b/NotifyPropertyChangedBase.Tests.Net45/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..f141ff8 --- /dev/null +++ b/NotifyPropertyChangedBase.Tests.Net45/Properties/AssemblyInfo.cs @@ -0,0 +1,3 @@ +using System.Reflection; + +[assembly: AssemblyTitle("NotifyPropertyChangedBase.Tests.Net45")] diff --git a/NotifyPropertyChangedBase.Tests.Net45/packages.config b/NotifyPropertyChangedBase.Tests.Net45/packages.config new file mode 100644 index 0000000..fc2bbdd --- /dev/null +++ b/NotifyPropertyChangedBase.Tests.Net45/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/NotifyPropertyChangedBase.Tests.NetCore/NotifyPropertyChangedBase.Tests.NetCore.csproj b/NotifyPropertyChangedBase.Tests.NetCore/NotifyPropertyChangedBase.Tests.NetCore.csproj new file mode 100644 index 0000000..3a369d4 --- /dev/null +++ b/NotifyPropertyChangedBase.Tests.NetCore/NotifyPropertyChangedBase.Tests.NetCore.csproj @@ -0,0 +1,33 @@ + + + + netcoreapp1.0 + NotifyPropertyChangedBase.Tests + NotifyPropertyChangedBase + NotifyPropertyChangedBase.Tests + An easy to use base class that helps you implement the INotifyPropertyChanged interface. + Marian Dolinský + Marian Dolinský + © 2017 Marian Dolinský + 1.0.0 + 1.0.0.0 + 1.0.0.0 + + + + + + + + + + + + + + + + + + + diff --git a/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedBase.Tests.projitems b/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedBase.Tests.projitems new file mode 100644 index 0000000..e4b07c9 --- /dev/null +++ b/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedBase.Tests.projitems @@ -0,0 +1,15 @@ + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + true + a5bff919-d838-4b1b-acd8-9f234304db94 + + + NotifyPropertyChangedBase.Tests + + + + + + \ No newline at end of file diff --git a/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedBase.Tests.shproj b/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedBase.Tests.shproj new file mode 100644 index 0000000..4fd2017 --- /dev/null +++ b/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedBase.Tests.shproj @@ -0,0 +1,13 @@ + + + + a5bff919-d838-4b1b-acd8-9f234304db94 + 14.0 + + + + + + + + diff --git a/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedTests.cs b/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedTests.cs new file mode 100644 index 0000000..d70c463 --- /dev/null +++ b/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedTests.cs @@ -0,0 +1,54 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; + +namespace NotifyPropertyChangedBase.Tests +{ + [TestClass] + public sealed class NotifyPropertyChangedTests + { + [TestMethod] + public void RegisterPropertyTests() + { + Wrapper w = new Wrapper(); + + Assert.ThrowsException(() => w.RegisterProperty(null, typeof(int), 0)); + Assert.ThrowsException(() => w.RegisterProperty("", typeof(int), 0)); + Assert.ThrowsException(() => w.RegisterProperty(" ", typeof(int), 0)); + Assert.ThrowsException(() => w.RegisterProperty("\n\t\v\r", typeof(int), 0)); + + Assert.ThrowsException(() => w.RegisterProperty("P", null, 0)); + + Assert.ThrowsException(() => w.RegisterProperty("P", typeof(int), null)); + Assert.ThrowsException(() => w.RegisterProperty("P", typeof(int), true)); + Assert.ThrowsException(() => w.RegisterProperty("P", typeof(int), long.MaxValue)); + Assert.ThrowsException(() => w.RegisterProperty("P", typeof(int), 'x')); + Assert.ThrowsException(() => w.RegisterProperty("P", typeof(int), "")); + Assert.ThrowsException(() => w.RegisterProperty("P", typeof(int), new Test())); + Assert.ThrowsException(() => w.RegisterProperty("P", typeof(uint), -1)); + + const string PROP_1 = "1"; + w.RegisterProperty(PROP_1, typeof(int), 0); + + Assert.ThrowsException(() => w.RegisterProperty(PROP_1, typeof(int), 0)); + + w.RegisterProperty("ITest", typeof(ITest), new Test()); + w.RegisterProperty("TestBase", typeof(TestBase), new Test()); + w.RegisterProperty("Test", typeof(Test), new Test()); + } + + private interface ITest + { + int Property { get; set; } + } + + private abstract class TestBase : ITest + { + public int Property { get; set; } + } + + private sealed class Test : TestBase + { + + } + } +} diff --git a/NotifyPropertyChangedBase.Tests/Wrapper.cs b/NotifyPropertyChangedBase.Tests/Wrapper.cs new file mode 100644 index 0000000..a489f3a --- /dev/null +++ b/NotifyPropertyChangedBase.Tests/Wrapper.cs @@ -0,0 +1,59 @@ +using System; +using System.Runtime.CompilerServices; + +namespace NotifyPropertyChangedBase.Tests +{ + internal sealed class Wrapper : NotifyPropertyChanged + { + internal new bool IsPropertyChangedCallbackInvokingEnabled + { + get { return base.IsPropertyChangedCallbackInvokingEnabled; } + set { base.IsPropertyChangedCallbackInvokingEnabled = value; } + } + internal new bool IsPropertyChangedEventInvokingEnabled + { + get { return base.IsPropertyChangedEventInvokingEnabled; } + set { base.IsPropertyChangedEventInvokingEnabled = value; } + } + + internal new void RegisterProperty(string name, Type type, object defaultValue) + { + base.RegisterProperty(name, type, defaultValue); + } + + internal new void RegisterProperty(string name, Type type, object defaultValue, PropertyChangedCallbackHandler propertyChangedCallback) + { + base.RegisterProperty(name, type, defaultValue, propertyChangedCallback); + } + + internal new void RegisterPropertyChangedCallback(string propertyName, PropertyChangedCallbackHandler propertyChangedCallback) + { + base.RegisterPropertyChangedCallback(propertyName, propertyChangedCallback); + } + + internal new void UnregisterPropertyChangedCallback(string propertyName, PropertyChangedCallbackHandler propertyChangedCallback) + { + base.UnregisterPropertyChangedCallback(propertyName, propertyChangedCallback); + } + + internal new object GetValue([CallerMemberName]string propertyName = null) + { + return base.GetValue(propertyName); + } + + internal new void ForceSetValue(object value, [CallerMemberName]string propertyName = null) + { + base.ForceSetValue(value, propertyName); + } + + internal new void SetValue(object value, [CallerMemberName]string propertyName = null) + { + base.SetValue(value, propertyName); + } + + internal new void OnPropertyChanged([CallerMemberName]string propertyName = null) + { + base.OnPropertyChanged(propertyName); + } + } +} diff --git a/NotifyPropertyChangedBase.sln b/NotifyPropertyChangedBase.sln index 14b7eb4..ebf60ba 100644 --- a/NotifyPropertyChangedBase.sln +++ b/NotifyPropertyChangedBase.sln @@ -1,11 +1,11 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26430.12 +VisualStudioVersion = 15.0.26430.14 MinimumVisualStudioVersion = 10.0.40219.1 Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "NotifyPropertyChangedBase", "NotifyPropertyChangedBase\NotifyPropertyChangedBase.shproj", "{036F1706-A135-46EA-A881-C2B334E9936D}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{121EBC4B-EA90-4A53-8E99-B56DA7C6646F}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Solution Items", "_Solution Items", "{121EBC4B-EA90-4A53-8E99-B56DA7C6646F}" ProjectSection(SolutionItems) = preProject .gitattributes = .gitattributes .gitignore = .gitignore @@ -24,15 +24,27 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotifyPropertyChangedBase.N EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotifyPropertyChangedBase.Uap", "NotifyPropertyChangedBase.Uap\NotifyPropertyChangedBase.Uap.csproj", "{25F76EE1-678A-4247-9697-5E5DAD3BB76E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotifyPropertyChangedBase.NetCore", "NotifyPropertyChangedBase.NetCore\NotifyPropertyChangedBase.NetCore.csproj", "{8917A083-31A8-4954-8656-99385FF09237}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NotifyPropertyChangedBase.NetCore", "NotifyPropertyChangedBase.NetCore\NotifyPropertyChangedBase.NetCore.csproj", "{8917A083-31A8-4954-8656-99385FF09237}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotifyPropertyChangedBase.NetStandard", "NotifyPropertyChangedBase.NetStandard\NotifyPropertyChangedBase.NetStandard.csproj", "{A053E7BD-A78E-4C4C-A5FB-141C34DA8159}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NotifyPropertyChangedBase.NetStandard", "NotifyPropertyChangedBase.NetStandard\NotifyPropertyChangedBase.NetStandard.csproj", "{A053E7BD-A78E-4C4C-A5FB-141C34DA8159}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Runtimes", "Runtimes", "{D2690E5B-F1A4-4657-A45C-7D480D656268}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{3C8ACE82-4738-477A-9270-328AB2D4356D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotifyPropertyChangedBase.Tests.Net45", "NotifyPropertyChangedBase.Tests.Net45\NotifyPropertyChangedBase.Tests.Net45.csproj", "{7422B848-AB65-4A37-BDB6-FEF98952A0D4}" +EndProject +Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "NotifyPropertyChangedBase.Tests", "NotifyPropertyChangedBase.Tests\NotifyPropertyChangedBase.Tests.shproj", "{A5BFF919-D838-4B1B-ACD8-9F234304DB94}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotifyPropertyChangedBase.Tests.NetCore", "NotifyPropertyChangedBase.Tests.NetCore\NotifyPropertyChangedBase.Tests.NetCore.csproj", "{A2BE674A-D893-41B3-AC92-531DAF84A5E5}" EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution NotifyPropertyChangedBase\NotifyPropertyChangedBase.projitems*{036f1706-a135-46ea-a881-c2b334e9936d}*SharedItemsImports = 13 NotifyPropertyChangedBase\NotifyPropertyChangedBase.projitems*{25f76ee1-678a-4247-9697-5e5dad3bb76e}*SharedItemsImports = 4 NotifyPropertyChangedBase\NotifyPropertyChangedBase.projitems*{53cf9f37-5693-46ea-b722-0e083ae61582}*SharedItemsImports = 4 + NotifyPropertyChangedBase.Tests\NotifyPropertyChangedBase.Tests.projitems*{7422b848-ab65-4a37-bdb6-fef98952a0d4}*SharedItemsImports = 4 + NotifyPropertyChangedBase.Tests\NotifyPropertyChangedBase.Tests.projitems*{a5bff919-d838-4b1b-acd8-9f234304db94}*SharedItemsImports = 13 NotifyPropertyChangedBase\NotifyPropertyChangedBase.projitems*{ac23ef0b-d5bd-401e-a074-4072dca935ac}*SharedItemsImports = 4 EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -126,8 +138,50 @@ Global {A053E7BD-A78E-4C4C-A5FB-141C34DA8159}.Release|x64.Build.0 = Release|Any CPU {A053E7BD-A78E-4C4C-A5FB-141C34DA8159}.Release|x86.ActiveCfg = Release|Any CPU {A053E7BD-A78E-4C4C-A5FB-141C34DA8159}.Release|x86.Build.0 = Release|Any CPU + {7422B848-AB65-4A37-BDB6-FEF98952A0D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7422B848-AB65-4A37-BDB6-FEF98952A0D4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7422B848-AB65-4A37-BDB6-FEF98952A0D4}.Debug|ARM.ActiveCfg = Debug|Any CPU + {7422B848-AB65-4A37-BDB6-FEF98952A0D4}.Debug|ARM.Build.0 = Debug|Any CPU + {7422B848-AB65-4A37-BDB6-FEF98952A0D4}.Debug|x64.ActiveCfg = Debug|Any CPU + {7422B848-AB65-4A37-BDB6-FEF98952A0D4}.Debug|x64.Build.0 = Debug|Any CPU + {7422B848-AB65-4A37-BDB6-FEF98952A0D4}.Debug|x86.ActiveCfg = Debug|Any CPU + {7422B848-AB65-4A37-BDB6-FEF98952A0D4}.Debug|x86.Build.0 = Debug|Any CPU + {7422B848-AB65-4A37-BDB6-FEF98952A0D4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7422B848-AB65-4A37-BDB6-FEF98952A0D4}.Release|Any CPU.Build.0 = Release|Any CPU + {7422B848-AB65-4A37-BDB6-FEF98952A0D4}.Release|ARM.ActiveCfg = Release|Any CPU + {7422B848-AB65-4A37-BDB6-FEF98952A0D4}.Release|ARM.Build.0 = Release|Any CPU + {7422B848-AB65-4A37-BDB6-FEF98952A0D4}.Release|x64.ActiveCfg = Release|Any CPU + {7422B848-AB65-4A37-BDB6-FEF98952A0D4}.Release|x64.Build.0 = Release|Any CPU + {7422B848-AB65-4A37-BDB6-FEF98952A0D4}.Release|x86.ActiveCfg = Release|Any CPU + {7422B848-AB65-4A37-BDB6-FEF98952A0D4}.Release|x86.Build.0 = Release|Any CPU + {A2BE674A-D893-41B3-AC92-531DAF84A5E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A2BE674A-D893-41B3-AC92-531DAF84A5E5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A2BE674A-D893-41B3-AC92-531DAF84A5E5}.Debug|ARM.ActiveCfg = Debug|Any CPU + {A2BE674A-D893-41B3-AC92-531DAF84A5E5}.Debug|ARM.Build.0 = Debug|Any CPU + {A2BE674A-D893-41B3-AC92-531DAF84A5E5}.Debug|x64.ActiveCfg = Debug|Any CPU + {A2BE674A-D893-41B3-AC92-531DAF84A5E5}.Debug|x64.Build.0 = Debug|Any CPU + {A2BE674A-D893-41B3-AC92-531DAF84A5E5}.Debug|x86.ActiveCfg = Debug|Any CPU + {A2BE674A-D893-41B3-AC92-531DAF84A5E5}.Debug|x86.Build.0 = Debug|Any CPU + {A2BE674A-D893-41B3-AC92-531DAF84A5E5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A2BE674A-D893-41B3-AC92-531DAF84A5E5}.Release|Any CPU.Build.0 = Release|Any CPU + {A2BE674A-D893-41B3-AC92-531DAF84A5E5}.Release|ARM.ActiveCfg = Release|Any CPU + {A2BE674A-D893-41B3-AC92-531DAF84A5E5}.Release|ARM.Build.0 = Release|Any CPU + {A2BE674A-D893-41B3-AC92-531DAF84A5E5}.Release|x64.ActiveCfg = Release|Any CPU + {A2BE674A-D893-41B3-AC92-531DAF84A5E5}.Release|x64.Build.0 = Release|Any CPU + {A2BE674A-D893-41B3-AC92-531DAF84A5E5}.Release|x86.ActiveCfg = Release|Any CPU + {A2BE674A-D893-41B3-AC92-531DAF84A5E5}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {53CF9F37-5693-46EA-B722-0E083AE61582} = {D2690E5B-F1A4-4657-A45C-7D480D656268} + {AC23EF0B-D5BD-401E-A074-4072DCA935AC} = {D2690E5B-F1A4-4657-A45C-7D480D656268} + {25F76EE1-678A-4247-9697-5E5DAD3BB76E} = {D2690E5B-F1A4-4657-A45C-7D480D656268} + {8917A083-31A8-4954-8656-99385FF09237} = {D2690E5B-F1A4-4657-A45C-7D480D656268} + {A053E7BD-A78E-4C4C-A5FB-141C34DA8159} = {D2690E5B-F1A4-4657-A45C-7D480D656268} + {3C8ACE82-4738-477A-9270-328AB2D4356D} = {D2690E5B-F1A4-4657-A45C-7D480D656268} + {7422B848-AB65-4A37-BDB6-FEF98952A0D4} = {3C8ACE82-4738-477A-9270-328AB2D4356D} + {A2BE674A-D893-41B3-AC92-531DAF84A5E5} = {3C8ACE82-4738-477A-9270-328AB2D4356D} + EndGlobalSection EndGlobal From c0e84aeb36fe79c8a4865e0d22c921923c19007c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Wed, 5 Jul 2017 22:38:40 +0200 Subject: [PATCH 014/118] Hopefully fixed build script, minor changes [skip deployment] --- AfterBuild.ps1 | 9 ++++++--- BeforeBuild.ps1 | 5 ++++- NotifyPropertyChangedBase/NotifyPropertyChanged.cs | 7 ++++--- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/AfterBuild.ps1 b/AfterBuild.ps1 index f8f8cad..625b2b7 100644 --- a/AfterBuild.ps1 +++ b/AfterBuild.ps1 @@ -1,12 +1,15 @@ -Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildScripts/master/Scripts/Set-PureBuildVersion.ps1" +Write-Host "`nAfterBuild script executed" +Write-Host "==========================" + +Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildScripts/master/Scripts/Set-PureBuildVersion.ps1" .\Set-PureBuildVersion.ps1 $projectFolders = Get-ChildItem -Directory -Filter "NotifyPropertyChangedBase*" foreach ($projectFolder in $projectFolders) { - # Skip the Shared project - if ($projectFolder.Name -eq "NotifyPropertyChangedBase") + # Skip the Shared projects + if (($projectFolder.Name -eq "NotifyPropertyChangedBase") -or ($projectFolder.Name -eq "NotifyPropertyChangedBase.Tests")) { continue; } diff --git a/BeforeBuild.ps1 b/BeforeBuild.ps1 index 11116eb..5479538 100644 --- a/BeforeBuild.ps1 +++ b/BeforeBuild.ps1 @@ -1,3 +1,6 @@ +Write-Host "`nBeforeBuild script executed" +Write-Host "===========================" + Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildScripts/master/Scripts/Set-BuildVersion.ps1" .\Set-BuildVersion.ps1 @@ -24,7 +27,7 @@ $projectFolders = Get-ChildItem -Include "*.NetCore","*.NetStandard" -Directory foreach ($projectFolder in $projectFolders) { - $xmlPath = "$projectFolder.FullName\$projectFolder.Name.csproj" + $xmlPath = Join-Path $projectFolder.FullName $($projectFolder.Name).csproj $xml = [xml](Get-Content $xmlPath) $propertyGroup = $xml.Project.PropertyGroup diff --git a/NotifyPropertyChangedBase/NotifyPropertyChanged.cs b/NotifyPropertyChangedBase/NotifyPropertyChanged.cs index 34ef50e..fdd3206 100644 --- a/NotifyPropertyChangedBase/NotifyPropertyChanged.cs +++ b/NotifyPropertyChangedBase/NotifyPropertyChanged.cs @@ -299,8 +299,9 @@ private class PropertyData internal PropertyData(object defaultValue, Type type, PropertyChangedCallbackHandler propertyChangedCallback) { - Value = defaultValue; - Type = type; + Value = defaultValue; + Type = type; + PropertyChangedCallback += propertyChangedCallback; } @@ -343,7 +344,7 @@ public sealed class PropertyChangedCallbackArgs /// Current value of the changed property. public PropertyChangedCallbackArgs(object oldValue, object newValue) { - Handled = false; + Handled = false; OldValue = oldValue; NewValue = newValue; } From 89513e22aebd32077371ecf430a3d4d98bbc04b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Wed, 5 Jul 2017 22:50:01 +0200 Subject: [PATCH 015/118] =?UTF-8?q?Why=20does=20it=20allways=20have=20to?= =?UTF-8?q?=20take=20so=20much=20commits=20=E3=80=90=C3=B3=20=CA=96=CC=AF?= =?UTF-8?q?=C3=B2=E3=80=91=20Testing=20something=20now..?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AfterBuild.ps1 | 2 +- BeforeBuild.ps1 | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/AfterBuild.ps1 b/AfterBuild.ps1 index 625b2b7..6951772 100644 --- a/AfterBuild.ps1 +++ b/AfterBuild.ps1 @@ -28,7 +28,7 @@ foreach ($projectFolder in $projectFolders) if (!(Test-Path $releaseFolder)) { throw "Invalid project release folder. `$releaseFolder: '$releaseFolder'" - } + } $zipFileName = "$projectFolder.$env:APPVEYOR_BUILD_VERSION.zip" 7z a $zipFileName "$releaseFolder\*" diff --git a/BeforeBuild.ps1 b/BeforeBuild.ps1 index 5479538..f690a29 100644 --- a/BeforeBuild.ps1 +++ b/BeforeBuild.ps1 @@ -27,7 +27,14 @@ $projectFolders = Get-ChildItem -Include "*.NetCore","*.NetStandard" -Directory foreach ($projectFolder in $projectFolders) { - $xmlPath = Join-Path $projectFolder.FullName $($projectFolder.Name).csproj + # $xmlPath = Join-Path $projectFolder.FullName "$($projectFolder.Name).csproj" + $xmlPath = Join-Path $projectFolder.FullName $($projectFolder.Name).csproj + + if (!(Test-Path $xmlPath)) + { + throw "Invalid csproj file path. `$xmlPath: '$xmlPath'" + } + $xml = [xml](Get-Content $xmlPath) $propertyGroup = $xml.Project.PropertyGroup From 4b30587081fc784611c0ea65133ecb4ae1d963a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Wed, 5 Jul 2017 22:53:47 +0200 Subject: [PATCH 016/118] More testing.. [skip deployment] --- BeforeBuild.ps1 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/BeforeBuild.ps1 b/BeforeBuild.ps1 index f690a29..5bbaaaa 100644 --- a/BeforeBuild.ps1 +++ b/BeforeBuild.ps1 @@ -29,14 +29,15 @@ foreach ($projectFolder in $projectFolders) { # $xmlPath = Join-Path $projectFolder.FullName "$($projectFolder.Name).csproj" $xmlPath = Join-Path $projectFolder.FullName $($projectFolder.Name).csproj - + Write-Host $xmlPath -ForegroundColor Green + Write-Host (Test-Path $xmlPath) -ForegroundColor Green if (!(Test-Path $xmlPath)) { throw "Invalid csproj file path. `$xmlPath: '$xmlPath'" } - $xml = [xml](Get-Content $xmlPath) - $propertyGroup = $xml.Project.PropertyGroup + $xml = [xml](Get-Content $xmlPath) + $propertyGroup = $xml.Project.PropertyGroup $propertyGroup.Version = $buildVersion $propertyGroup.AssemblyVersion = $buildVersion From 75080fc65b51df73073a5451c970c57b296edaa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Wed, 5 Jul 2017 23:08:20 +0200 Subject: [PATCH 017/118] Should work now [skip deployment] --- BeforeBuild.ps1 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/BeforeBuild.ps1 b/BeforeBuild.ps1 index 5bbaaaa..947231b 100644 --- a/BeforeBuild.ps1 +++ b/BeforeBuild.ps1 @@ -29,9 +29,8 @@ foreach ($projectFolder in $projectFolders) { # $xmlPath = Join-Path $projectFolder.FullName "$($projectFolder.Name).csproj" $xmlPath = Join-Path $projectFolder.FullName $($projectFolder.Name).csproj - Write-Host $xmlPath -ForegroundColor Green - Write-Host (Test-Path $xmlPath) -ForegroundColor Green - if (!(Test-Path $xmlPath)) + + if ((!(Test-Path $xmlPath)) -or (!($xmlPath.EndsWith(".csproj")))) { throw "Invalid csproj file path. `$xmlPath: '$xmlPath'" } From b06ca492d70dc8cf4ce57f36c0d626ae0e35b826 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Wed, 5 Jul 2017 23:12:01 +0200 Subject: [PATCH 018/118] =?UTF-8?q?Finally=20worked=20=E2=98=9E=E2=8C=90?= =?UTF-8?q?=E2=96=A0=20=CD=9C=CA=96=E2=96=A0=E2=98=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BeforeBuild.ps1 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/BeforeBuild.ps1 b/BeforeBuild.ps1 index 947231b..ca6328e 100644 --- a/BeforeBuild.ps1 +++ b/BeforeBuild.ps1 @@ -27,8 +27,7 @@ $projectFolders = Get-ChildItem -Include "*.NetCore","*.NetStandard" -Directory foreach ($projectFolder in $projectFolders) { - # $xmlPath = Join-Path $projectFolder.FullName "$($projectFolder.Name).csproj" - $xmlPath = Join-Path $projectFolder.FullName $($projectFolder.Name).csproj + $xmlPath = Join-Path $projectFolder.FullName "$($projectFolder.Name).csproj" if ((!(Test-Path $xmlPath)) -or (!($xmlPath.EndsWith(".csproj")))) { From 7fa5585dbf1209729b2e81780d68ec3f771221da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 6 Jul 2017 16:47:50 +0200 Subject: [PATCH 019/118] Testing something.. [skip deployment] --- AfterBuild.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/AfterBuild.ps1 b/AfterBuild.ps1 index 6951772..093f773 100644 --- a/AfterBuild.ps1 +++ b/AfterBuild.ps1 @@ -40,4 +40,6 @@ Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildSc .\NuGet-Pack.ps1 Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildScripts/master/Scripts/Deployment-Skipping.ps1" -.\Deployment-Skipping.ps1 \ No newline at end of file +.\Deployment-Skipping.ps1 + +& "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\MSTest" /testcontainer:NotifyPropertyChangedBase.Tests.NetCore/NotifyPropertyChangedBase.Tests.NetCore.dll /nologo \ No newline at end of file From 61db861570502b920196b8ec0284e9d98f83387b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 6 Jul 2017 16:51:37 +0200 Subject: [PATCH 020/118] This one? [skip deployment] --- AfterBuild.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AfterBuild.ps1 b/AfterBuild.ps1 index 093f773..5118fca 100644 --- a/AfterBuild.ps1 +++ b/AfterBuild.ps1 @@ -42,4 +42,4 @@ Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildSc Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildScripts/master/Scripts/Deployment-Skipping.ps1" .\Deployment-Skipping.ps1 -& "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\MSTest" /testcontainer:NotifyPropertyChangedBase.Tests.NetCore/NotifyPropertyChangedBase.Tests.NetCore.dll /nologo \ No newline at end of file +& "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\MSTest" /testcontainer:./NotifyPropertyChangedBase.Tests.NetCore/NotifyPropertyChangedBase.Tests.NetCore.dll /nologo \ No newline at end of file From 79163679f4dfb0041cacc7e499378b1acc7ff5fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 6 Jul 2017 16:54:16 +0200 Subject: [PATCH 021/118] Hmm? [skip deployment] --- AfterBuild.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AfterBuild.ps1 b/AfterBuild.ps1 index 5118fca..80cf34d 100644 --- a/AfterBuild.ps1 +++ b/AfterBuild.ps1 @@ -42,4 +42,4 @@ Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildSc Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildScripts/master/Scripts/Deployment-Skipping.ps1" .\Deployment-Skipping.ps1 -& "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\MSTest" /testcontainer:./NotifyPropertyChangedBase.Tests.NetCore/NotifyPropertyChangedBase.Tests.NetCore.dll /nologo \ No newline at end of file +& "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\MSTest" /testcontainer:/NotifyPropertyChangedBase.Tests.NetCore/NotifyPropertyChangedBase.Tests.NetCore.dll /nologo \ No newline at end of file From cbadfe0455332c09836ce535af800461b6f2623b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 6 Jul 2017 16:56:53 +0200 Subject: [PATCH 022/118] Well.. F*ck it [skip ci] --- AfterBuild.ps1 | 2 -- 1 file changed, 2 deletions(-) diff --git a/AfterBuild.ps1 b/AfterBuild.ps1 index 80cf34d..587fcce 100644 --- a/AfterBuild.ps1 +++ b/AfterBuild.ps1 @@ -41,5 +41,3 @@ Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildSc Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildScripts/master/Scripts/Deployment-Skipping.ps1" .\Deployment-Skipping.ps1 - -& "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\MSTest" /testcontainer:/NotifyPropertyChangedBase.Tests.NetCore/NotifyPropertyChangedBase.Tests.NetCore.dll /nologo \ No newline at end of file From 79409ec79d6a5c05808c576302e6c4a298a9ddd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 6 Jul 2017 17:02:54 +0200 Subject: [PATCH 023/118] Fixed NuGet structure, minor improvements in tests, testing AppVeyor with tests failing --- .../NotifyPropertyChangedTests.cs | 11 ++++++++--- NotifyPropertyChangedBase.nuspec | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedTests.cs b/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedTests.cs index d70c463..e829604 100644 --- a/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedTests.cs +++ b/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedTests.cs @@ -31,9 +31,14 @@ public void RegisterPropertyTests() Assert.ThrowsException(() => w.RegisterProperty(PROP_1, typeof(int), 0)); - w.RegisterProperty("ITest", typeof(ITest), new Test()); - w.RegisterProperty("TestBase", typeof(TestBase), new Test()); - w.RegisterProperty("Test", typeof(Test), new Test()); + w.RegisterProperty("ITest", typeof(ITest), null); + w.RegisterProperty("ITest2", typeof(ITest), new Test()); + w.RegisterProperty("TestBase", typeof(TestBase), null); + w.RegisterProperty("TestBase2", typeof(TestBase), new Test()); + w.RegisterProperty("Test", typeof(Test), null); + w.RegisterProperty("Test2", typeof(Test), new Test()); + + Assert.Fail(); } private interface ITest diff --git a/NotifyPropertyChangedBase.nuspec b/NotifyPropertyChangedBase.nuspec index 0eae115..8637621 100644 --- a/NotifyPropertyChangedBase.nuspec +++ b/NotifyPropertyChangedBase.nuspec @@ -31,8 +31,8 @@ - - + + \ No newline at end of file From 0422b21c3db5cf02484ef5f1985ee88c6528a6ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 6 Jul 2017 17:56:19 +0200 Subject: [PATCH 024/118] Testing it once again [skip deployment] --- AfterBuild.ps1 | 2 ++ NotifyPropertyChangedBase.Tests/NotifyPropertyChangedTests.cs | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/AfterBuild.ps1 b/AfterBuild.ps1 index 587fcce..5f85fb2 100644 --- a/AfterBuild.ps1 +++ b/AfterBuild.ps1 @@ -41,3 +41,5 @@ Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildSc Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildScripts/master/Scripts/Deployment-Skipping.ps1" .\Deployment-Skipping.ps1 + +dotnet vstest NotifyPropertyChangedBase.Tests.NetCore.dll /logger:Appveyor diff --git a/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedTests.cs b/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedTests.cs index e829604..c98b7f3 100644 --- a/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedTests.cs +++ b/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedTests.cs @@ -37,8 +37,6 @@ public void RegisterPropertyTests() w.RegisterProperty("TestBase2", typeof(TestBase), new Test()); w.RegisterProperty("Test", typeof(Test), null); w.RegisterProperty("Test2", typeof(Test), new Test()); - - Assert.Fail(); } private interface ITest From fd110c75460cb8071d929fcc8500bc91b2335758 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 6 Jul 2017 18:04:24 +0200 Subject: [PATCH 025/118] Investigating.. --- appveyor.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index ac6a00f..2e09a18 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -22,6 +22,12 @@ assembly_info: assembly_informational_version: 1.2.2.{build} before_build: - ps: '& .\BeforeBuild.ps1' +####### +init: + - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) +on_finish: + - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) +##### build: verbosity: minimal after_build: From 513901b1b43a8d2548a237fd54c39c5946347c3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 6 Jul 2017 18:13:39 +0200 Subject: [PATCH 026/118] More testing.. --- AfterBuild.ps1 | 2 +- appveyor.yml | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/AfterBuild.ps1 b/AfterBuild.ps1 index 5f85fb2..0975b88 100644 --- a/AfterBuild.ps1 +++ b/AfterBuild.ps1 @@ -42,4 +42,4 @@ Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildSc Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildScripts/master/Scripts/Deployment-Skipping.ps1" .\Deployment-Skipping.ps1 -dotnet vstest NotifyPropertyChangedBase.Tests.NetCore.dll /logger:Appveyor +dotnet vstest NotifyPropertyChangedBase.Tests.NetCore.dll /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" diff --git a/appveyor.yml b/appveyor.yml index 2e09a18..ac6a00f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -22,12 +22,6 @@ assembly_info: assembly_informational_version: 1.2.2.{build} before_build: - ps: '& .\BeforeBuild.ps1' -####### -init: - - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) -on_finish: - - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) -##### build: verbosity: minimal after_build: From 73cccdb4a9adefa2aef76969f33dfe3b5009323b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 6 Jul 2017 18:17:11 +0200 Subject: [PATCH 027/118] This? [skip deployment] --- AfterBuild.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AfterBuild.ps1 b/AfterBuild.ps1 index 0975b88..49adda3 100644 --- a/AfterBuild.ps1 +++ b/AfterBuild.ps1 @@ -42,4 +42,4 @@ Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildSc Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildScripts/master/Scripts/Deployment-Skipping.ps1" .\Deployment-Skipping.ps1 -dotnet vstest NotifyPropertyChangedBase.Tests.NetCore.dll /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" +dotnet vstest NotifyPropertyChangedBase.Tests.NetCore.dll /logger:trx From 41fd414bbee06e0f62f2a99e6f1dbff46ac3d24d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 6 Jul 2017 18:22:29 +0200 Subject: [PATCH 028/118] I HATE IT!!! [skip deployment] --- AfterBuild.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AfterBuild.ps1 b/AfterBuild.ps1 index 49adda3..93579c5 100644 --- a/AfterBuild.ps1 +++ b/AfterBuild.ps1 @@ -42,4 +42,4 @@ Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildSc Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildScripts/master/Scripts/Deployment-Skipping.ps1" .\Deployment-Skipping.ps1 -dotnet vstest NotifyPropertyChangedBase.Tests.NetCore.dll /logger:trx +dotnet vstest .\NotifyPropertyChangedBase.Tests.NetCore\bin\Debug\netcoreapp1.0\NotifyPropertyChangedBase.Tests.NetCore.dll /logger:trx From 2bf4f90638c7b9d1709a7736d7614f3c42321fef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 6 Jul 2017 18:29:55 +0200 Subject: [PATCH 029/118] ... [skip deployment] --- AfterBuild.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AfterBuild.ps1 b/AfterBuild.ps1 index 93579c5..dc7477c 100644 --- a/AfterBuild.ps1 +++ b/AfterBuild.ps1 @@ -42,4 +42,4 @@ Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildSc Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildScripts/master/Scripts/Deployment-Skipping.ps1" .\Deployment-Skipping.ps1 -dotnet vstest .\NotifyPropertyChangedBase.Tests.NetCore\bin\Debug\netcoreapp1.0\NotifyPropertyChangedBase.Tests.NetCore.dll /logger:trx +dotnet vstest NotifyPropertyChangedBase.Tests.NetCore\bin\Debug\netcoreapp1.0\NotifyPropertyChangedBase.Tests.NetCore.dll /logger:trx From 2158a1070442da9afa20507062cb9f588566d555 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 6 Jul 2017 18:34:35 +0200 Subject: [PATCH 030/118] I should start thinking before commiting... [skip deployment] --- AfterBuild.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AfterBuild.ps1 b/AfterBuild.ps1 index dc7477c..c589723 100644 --- a/AfterBuild.ps1 +++ b/AfterBuild.ps1 @@ -42,4 +42,4 @@ Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildSc Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildScripts/master/Scripts/Deployment-Skipping.ps1" .\Deployment-Skipping.ps1 -dotnet vstest NotifyPropertyChangedBase.Tests.NetCore\bin\Debug\netcoreapp1.0\NotifyPropertyChangedBase.Tests.NetCore.dll /logger:trx +dotnet vstest NotifyPropertyChangedBase.Tests.NetCore\bin\Release\netcoreapp1.0\NotifyPropertyChangedBase.Tests.NetCore.dll /logger:trx From 2f9123b99a2a3825cb3467c958cfbb552d4c20b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 6 Jul 2017 19:07:35 +0200 Subject: [PATCH 031/118] Investigating.. --- appveyor.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index ac6a00f..c567925 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -41,3 +41,11 @@ deploy: on: branch: master SKIP_DEPLOYMENT: false + + +####### +init: + - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) +on_finish: + - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) +####### \ No newline at end of file From 16e31af9be23861ad4a64f0dbb6020fafdd94d2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Sat, 8 Jul 2017 12:24:13 +0200 Subject: [PATCH 032/118] Testing failing .NET Core tests [skip deployment] --- AfterBuild.ps1 | 25 ++++++++++++++++++- .../NotifyPropertyChangedTests.cs | 6 +++++ appveyor.yml | 8 ------ 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/AfterBuild.ps1 b/AfterBuild.ps1 index c589723..0305ede 100644 --- a/AfterBuild.ps1 +++ b/AfterBuild.ps1 @@ -42,4 +42,27 @@ Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildSc Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildScripts/master/Scripts/Deployment-Skipping.ps1" .\Deployment-Skipping.ps1 -dotnet vstest NotifyPropertyChangedBase.Tests.NetCore\bin\Release\netcoreapp1.0\NotifyPropertyChangedBase.Tests.NetCore.dll /logger:trx +dotnet vstest NotifyPropertyChangedBase.Tests.NetCore\bin\Release\netcoreapp1.0\NotifyPropertyChangedBase.Tests.NetCore.dll | Tee-Object -Variable testOutput +$results = $testOutput | Where-Object { $_.StartsWith("Total tests:") } +$counts = [Regex]::Matches($results, "\d+") | ForEach-Object { $_.Value } + +if ($counts.Count -ne 4) +{ + throw "Total number of numbers parsed is wrong. `$counts.Count: '$($counts.Count)'" +} + +$total = [int]$counts[0] +$passed = [int]$counts[1] +$failed = [int]$counts[2] +$skipped = [int]$counts[3] + +# Simple check whether we've parsed the results correctly +if ($total -ne ($passed + $failed + $skipped)) +{ + throw "Total number of test run was not the same as sum of test passed, failed and skipped." +} + +if ($failed -ne 0) +{ + throw "$failed of unit tests failed" +} diff --git a/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedTests.cs b/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedTests.cs index c98b7f3..d3d20fe 100644 --- a/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedTests.cs +++ b/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedTests.cs @@ -39,6 +39,12 @@ public void RegisterPropertyTests() w.RegisterProperty("Test2", typeof(Test), new Test()); } + [TestMethod] + public void GetValueTests() + { + Assert.Fail(); + } + private interface ITest { int Property { get; set; } diff --git a/appveyor.yml b/appveyor.yml index c567925..ac6a00f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -41,11 +41,3 @@ deploy: on: branch: master SKIP_DEPLOYMENT: false - - -####### -init: - - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) -on_finish: - - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) -####### \ No newline at end of file From b92e8b13955d1d06bc1a3b3378c0ff4e3b1595cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Sat, 8 Jul 2017 12:30:32 +0200 Subject: [PATCH 033/118] And will it work now? [skip deployment] --- NotifyPropertyChangedBase.Tests/NotifyPropertyChangedTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedTests.cs b/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedTests.cs index d3d20fe..fa2521a 100644 --- a/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedTests.cs +++ b/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedTests.cs @@ -42,7 +42,7 @@ public void RegisterPropertyTests() [TestMethod] public void GetValueTests() { - Assert.Fail(); + } private interface ITest From 1a2f81be301067b5ab9578e607002ec30b206fae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Mon, 10 Jul 2017 23:03:49 +0200 Subject: [PATCH 034/118] Removed .NET Core and UWP projects since .NET Standard is enough for these platforms --- .../NotifyPropertyChangedBase.NetCore.csproj | 19 --- ...tifyPropertyChangedBase.NetStandard.csproj | 8 + ...fyPropertyChangedBase.Tests.NetCore.csproj | 2 +- .../NotifyPropertyChangedBase.Uap.csproj | 140 ------------------ .../Properties/AssemblyInfo.cs | 3 - .../NotifyPropertyChangedBase.Uap.rd.xml | 47 ------ NotifyPropertyChangedBase.nuspec | 8 - NotifyPropertyChangedBase.sln | 123 +-------------- .../NotifyPropertyChanged.cs | 2 - 9 files changed, 12 insertions(+), 340 deletions(-) delete mode 100644 NotifyPropertyChangedBase.NetCore/NotifyPropertyChangedBase.NetCore.csproj delete mode 100644 NotifyPropertyChangedBase.Uap/NotifyPropertyChangedBase.Uap.csproj delete mode 100644 NotifyPropertyChangedBase.Uap/Properties/AssemblyInfo.cs delete mode 100644 NotifyPropertyChangedBase.Uap/Properties/NotifyPropertyChangedBase.Uap.rd.xml diff --git a/NotifyPropertyChangedBase.NetCore/NotifyPropertyChangedBase.NetCore.csproj b/NotifyPropertyChangedBase.NetCore/NotifyPropertyChangedBase.NetCore.csproj deleted file mode 100644 index 49f4ad1..0000000 --- a/NotifyPropertyChangedBase.NetCore/NotifyPropertyChangedBase.NetCore.csproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - netcoreapp1.0 - NotifyPropertyChangedBase - NotifyPropertyChangedBase - NotifyPropertyChangedBase - An easy to use base class that helps you implement the INotifyPropertyChanged interface. - Marian Dolinský - Marian Dolinský - © 2017 Marian Dolinský - 1.0.0 - 1.0.0.0 - 1.0.0.0 - - - - - \ No newline at end of file diff --git a/NotifyPropertyChangedBase.NetStandard/NotifyPropertyChangedBase.NetStandard.csproj b/NotifyPropertyChangedBase.NetStandard/NotifyPropertyChangedBase.NetStandard.csproj index 69f15d0..a2ed78f 100644 --- a/NotifyPropertyChangedBase.NetStandard/NotifyPropertyChangedBase.NetStandard.csproj +++ b/NotifyPropertyChangedBase.NetStandard/NotifyPropertyChangedBase.NetStandard.csproj @@ -14,6 +14,14 @@ 1.0.0.0 + + bin\Release\netstandard1.0\NotifyPropertyChangedBase.NetStandard.xml + + + + bin\Debug\netstandard1.0\NotifyPropertyChangedBase.NetStandard.xml + + \ No newline at end of file diff --git a/NotifyPropertyChangedBase.Tests.NetCore/NotifyPropertyChangedBase.Tests.NetCore.csproj b/NotifyPropertyChangedBase.Tests.NetCore/NotifyPropertyChangedBase.Tests.NetCore.csproj index 3a369d4..e57f446 100644 --- a/NotifyPropertyChangedBase.Tests.NetCore/NotifyPropertyChangedBase.Tests.NetCore.csproj +++ b/NotifyPropertyChangedBase.Tests.NetCore/NotifyPropertyChangedBase.Tests.NetCore.csproj @@ -21,7 +21,7 @@ - + diff --git a/NotifyPropertyChangedBase.Uap/NotifyPropertyChangedBase.Uap.csproj b/NotifyPropertyChangedBase.Uap/NotifyPropertyChangedBase.Uap.csproj deleted file mode 100644 index ffdbb17..0000000 --- a/NotifyPropertyChangedBase.Uap/NotifyPropertyChangedBase.Uap.csproj +++ /dev/null @@ -1,140 +0,0 @@ - - - - - Debug - AnyCPU - {25F76EE1-678A-4247-9697-5E5DAD3BB76E} - Library - Properties - NotifyPropertyChangedBase - NotifyPropertyChangedBase.Uap - en-US - UAP - 10.0.15063.0 - 10.0.10240.0 - 14 - 512 - {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP - prompt - 4 - bin\Debug\NotifyPropertyChangedBase.Uap.XML - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE;NETFX_CORE;WINDOWS_UWP - prompt - 4 - bin\Release\NotifyPropertyChangedBase.Uap.XML - - - x86 - true - bin\x86\Debug\ - DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP - ;2008 - full - x86 - false - prompt - bin\x86\Debug\NotifyPropertyChangedBase.Uap.XML - - - x86 - bin\x86\Release\ - TRACE;NETFX_CORE;WINDOWS_UWP - true - ;2008 - pdbonly - x86 - false - prompt - bin\x86\Release\NotifyPropertyChangedBase.Uap.XML - - - ARM - true - bin\ARM\Debug\ - DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP - ;2008 - full - ARM - false - prompt - bin\ARM\Debug\NotifyPropertyChangedBase.Uap.XML - - - ARM - bin\ARM\Release\ - TRACE;NETFX_CORE;WINDOWS_UWP - true - ;2008 - pdbonly - ARM - false - prompt - bin\ARM\Release\NotifyPropertyChangedBase.Uap.XML - - - x64 - true - bin\x64\Debug\ - DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP - ;2008 - full - x64 - false - prompt - bin\x64\Debug\NotifyPropertyChangedBase.Uap.XML - - - x64 - bin\x64\Release\ - TRACE;NETFX_CORE;WINDOWS_UWP - true - ;2008 - pdbonly - x64 - false - prompt - bin\x64\Release\NotifyPropertyChangedBase.Uap.XML - - - PackageReference - - - - Properties\SharedAssemblyInfo.cs - - - - - - - 5.3.3 - - - - - 14.0 - - - - \ No newline at end of file diff --git a/NotifyPropertyChangedBase.Uap/Properties/AssemblyInfo.cs b/NotifyPropertyChangedBase.Uap/Properties/AssemblyInfo.cs deleted file mode 100644 index af4fc2b..0000000 --- a/NotifyPropertyChangedBase.Uap/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,3 +0,0 @@ -using System.Reflection; - -[assembly: AssemblyTitle("NotifyPropertyChangedBase.Uap")] \ No newline at end of file diff --git a/NotifyPropertyChangedBase.Uap/Properties/NotifyPropertyChangedBase.Uap.rd.xml b/NotifyPropertyChangedBase.Uap/Properties/NotifyPropertyChangedBase.Uap.rd.xml deleted file mode 100644 index 53dd32c..0000000 --- a/NotifyPropertyChangedBase.Uap/Properties/NotifyPropertyChangedBase.Uap.rd.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/NotifyPropertyChangedBase.nuspec b/NotifyPropertyChangedBase.nuspec index 8637621..95ba90b 100644 --- a/NotifyPropertyChangedBase.nuspec +++ b/NotifyPropertyChangedBase.nuspec @@ -17,12 +17,6 @@ - - - - - - @@ -31,8 +25,6 @@ - - \ No newline at end of file diff --git a/NotifyPropertyChangedBase.sln b/NotifyPropertyChangedBase.sln index ebf60ba..b007189 100644 --- a/NotifyPropertyChangedBase.sln +++ b/NotifyPropertyChangedBase.sln @@ -1,11 +1,11 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26430.14 +VisualStudioVersion = 15.0.26430.15 MinimumVisualStudioVersion = 10.0.40219.1 Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "NotifyPropertyChangedBase", "NotifyPropertyChangedBase\NotifyPropertyChangedBase.shproj", "{036F1706-A135-46EA-A881-C2B334E9936D}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Solution Items", "_Solution Items", "{121EBC4B-EA90-4A53-8E99-B56DA7C6646F}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{121EBC4B-EA90-4A53-8E99-B56DA7C6646F}" ProjectSection(SolutionItems) = preProject .gitattributes = .gitattributes .gitignore = .gitignore @@ -22,26 +22,17 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotifyPropertyChangedBase.N EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotifyPropertyChangedBase.Net45", "NotifyPropertyChangedBase.Net45\NotifyPropertyChangedBase.Net45.csproj", "{AC23EF0B-D5BD-401E-A074-4072DCA935AC}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotifyPropertyChangedBase.Uap", "NotifyPropertyChangedBase.Uap\NotifyPropertyChangedBase.Uap.csproj", "{25F76EE1-678A-4247-9697-5E5DAD3BB76E}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NotifyPropertyChangedBase.NetCore", "NotifyPropertyChangedBase.NetCore\NotifyPropertyChangedBase.NetCore.csproj", "{8917A083-31A8-4954-8656-99385FF09237}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NotifyPropertyChangedBase.NetStandard", "NotifyPropertyChangedBase.NetStandard\NotifyPropertyChangedBase.NetStandard.csproj", "{A053E7BD-A78E-4C4C-A5FB-141C34DA8159}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Runtimes", "Runtimes", "{D2690E5B-F1A4-4657-A45C-7D480D656268}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{3C8ACE82-4738-477A-9270-328AB2D4356D}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotifyPropertyChangedBase.Tests.Net45", "NotifyPropertyChangedBase.Tests.Net45\NotifyPropertyChangedBase.Tests.Net45.csproj", "{7422B848-AB65-4A37-BDB6-FEF98952A0D4}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "NotifyPropertyChangedBase.Tests", "NotifyPropertyChangedBase.Tests\NotifyPropertyChangedBase.Tests.shproj", "{A5BFF919-D838-4B1B-ACD8-9F234304DB94}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotifyPropertyChangedBase.Tests.NetCore", "NotifyPropertyChangedBase.Tests.NetCore\NotifyPropertyChangedBase.Tests.NetCore.csproj", "{A2BE674A-D893-41B3-AC92-531DAF84A5E5}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NotifyPropertyChangedBase.Tests.NetCore", "NotifyPropertyChangedBase.Tests.NetCore\NotifyPropertyChangedBase.Tests.NetCore.csproj", "{A2BE674A-D893-41B3-AC92-531DAF84A5E5}" EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution NotifyPropertyChangedBase\NotifyPropertyChangedBase.projitems*{036f1706-a135-46ea-a881-c2b334e9936d}*SharedItemsImports = 13 - NotifyPropertyChangedBase\NotifyPropertyChangedBase.projitems*{25f76ee1-678a-4247-9697-5e5dad3bb76e}*SharedItemsImports = 4 NotifyPropertyChangedBase\NotifyPropertyChangedBase.projitems*{53cf9f37-5693-46ea-b722-0e083ae61582}*SharedItemsImports = 4 NotifyPropertyChangedBase.Tests\NotifyPropertyChangedBase.Tests.projitems*{7422b848-ab65-4a37-bdb6-fef98952a0d4}*SharedItemsImports = 4 NotifyPropertyChangedBase.Tests\NotifyPropertyChangedBase.Tests.projitems*{a5bff919-d838-4b1b-acd8-9f234304db94}*SharedItemsImports = 13 @@ -49,139 +40,31 @@ Global EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU - Debug|ARM = Debug|ARM - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU - Release|ARM = Release|ARM - Release|x64 = Release|x64 - Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {53CF9F37-5693-46EA-B722-0E083AE61582}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {53CF9F37-5693-46EA-B722-0E083AE61582}.Debug|Any CPU.Build.0 = Debug|Any CPU - {53CF9F37-5693-46EA-B722-0E083AE61582}.Debug|ARM.ActiveCfg = Debug|Any CPU - {53CF9F37-5693-46EA-B722-0E083AE61582}.Debug|ARM.Build.0 = Debug|Any CPU - {53CF9F37-5693-46EA-B722-0E083AE61582}.Debug|x64.ActiveCfg = Debug|Any CPU - {53CF9F37-5693-46EA-B722-0E083AE61582}.Debug|x64.Build.0 = Debug|Any CPU - {53CF9F37-5693-46EA-B722-0E083AE61582}.Debug|x86.ActiveCfg = Debug|Any CPU - {53CF9F37-5693-46EA-B722-0E083AE61582}.Debug|x86.Build.0 = Debug|Any CPU {53CF9F37-5693-46EA-B722-0E083AE61582}.Release|Any CPU.ActiveCfg = Release|Any CPU {53CF9F37-5693-46EA-B722-0E083AE61582}.Release|Any CPU.Build.0 = Release|Any CPU - {53CF9F37-5693-46EA-B722-0E083AE61582}.Release|ARM.ActiveCfg = Release|Any CPU - {53CF9F37-5693-46EA-B722-0E083AE61582}.Release|ARM.Build.0 = Release|Any CPU - {53CF9F37-5693-46EA-B722-0E083AE61582}.Release|x64.ActiveCfg = Release|Any CPU - {53CF9F37-5693-46EA-B722-0E083AE61582}.Release|x64.Build.0 = Release|Any CPU - {53CF9F37-5693-46EA-B722-0E083AE61582}.Release|x86.ActiveCfg = Release|Any CPU - {53CF9F37-5693-46EA-B722-0E083AE61582}.Release|x86.Build.0 = Release|Any CPU {AC23EF0B-D5BD-401E-A074-4072DCA935AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AC23EF0B-D5BD-401E-A074-4072DCA935AC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AC23EF0B-D5BD-401E-A074-4072DCA935AC}.Debug|ARM.ActiveCfg = Debug|Any CPU - {AC23EF0B-D5BD-401E-A074-4072DCA935AC}.Debug|ARM.Build.0 = Debug|Any CPU - {AC23EF0B-D5BD-401E-A074-4072DCA935AC}.Debug|x64.ActiveCfg = Debug|Any CPU - {AC23EF0B-D5BD-401E-A074-4072DCA935AC}.Debug|x64.Build.0 = Debug|Any CPU - {AC23EF0B-D5BD-401E-A074-4072DCA935AC}.Debug|x86.ActiveCfg = Debug|Any CPU - {AC23EF0B-D5BD-401E-A074-4072DCA935AC}.Debug|x86.Build.0 = Debug|Any CPU {AC23EF0B-D5BD-401E-A074-4072DCA935AC}.Release|Any CPU.ActiveCfg = Release|Any CPU {AC23EF0B-D5BD-401E-A074-4072DCA935AC}.Release|Any CPU.Build.0 = Release|Any CPU - {AC23EF0B-D5BD-401E-A074-4072DCA935AC}.Release|ARM.ActiveCfg = Release|Any CPU - {AC23EF0B-D5BD-401E-A074-4072DCA935AC}.Release|ARM.Build.0 = Release|Any CPU - {AC23EF0B-D5BD-401E-A074-4072DCA935AC}.Release|x64.ActiveCfg = Release|Any CPU - {AC23EF0B-D5BD-401E-A074-4072DCA935AC}.Release|x64.Build.0 = Release|Any CPU - {AC23EF0B-D5BD-401E-A074-4072DCA935AC}.Release|x86.ActiveCfg = Release|Any CPU - {AC23EF0B-D5BD-401E-A074-4072DCA935AC}.Release|x86.Build.0 = Release|Any CPU - {25F76EE1-678A-4247-9697-5E5DAD3BB76E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {25F76EE1-678A-4247-9697-5E5DAD3BB76E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {25F76EE1-678A-4247-9697-5E5DAD3BB76E}.Debug|ARM.ActiveCfg = Debug|ARM - {25F76EE1-678A-4247-9697-5E5DAD3BB76E}.Debug|ARM.Build.0 = Debug|ARM - {25F76EE1-678A-4247-9697-5E5DAD3BB76E}.Debug|x64.ActiveCfg = Debug|x64 - {25F76EE1-678A-4247-9697-5E5DAD3BB76E}.Debug|x64.Build.0 = Debug|x64 - {25F76EE1-678A-4247-9697-5E5DAD3BB76E}.Debug|x86.ActiveCfg = Debug|x86 - {25F76EE1-678A-4247-9697-5E5DAD3BB76E}.Debug|x86.Build.0 = Debug|x86 - {25F76EE1-678A-4247-9697-5E5DAD3BB76E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {25F76EE1-678A-4247-9697-5E5DAD3BB76E}.Release|Any CPU.Build.0 = Release|Any CPU - {25F76EE1-678A-4247-9697-5E5DAD3BB76E}.Release|ARM.ActiveCfg = Release|ARM - {25F76EE1-678A-4247-9697-5E5DAD3BB76E}.Release|ARM.Build.0 = Release|ARM - {25F76EE1-678A-4247-9697-5E5DAD3BB76E}.Release|x64.ActiveCfg = Release|x64 - {25F76EE1-678A-4247-9697-5E5DAD3BB76E}.Release|x64.Build.0 = Release|x64 - {25F76EE1-678A-4247-9697-5E5DAD3BB76E}.Release|x86.ActiveCfg = Release|x86 - {25F76EE1-678A-4247-9697-5E5DAD3BB76E}.Release|x86.Build.0 = Release|x86 - {8917A083-31A8-4954-8656-99385FF09237}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8917A083-31A8-4954-8656-99385FF09237}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8917A083-31A8-4954-8656-99385FF09237}.Debug|ARM.ActiveCfg = Debug|Any CPU - {8917A083-31A8-4954-8656-99385FF09237}.Debug|ARM.Build.0 = Debug|Any CPU - {8917A083-31A8-4954-8656-99385FF09237}.Debug|x64.ActiveCfg = Debug|Any CPU - {8917A083-31A8-4954-8656-99385FF09237}.Debug|x64.Build.0 = Debug|Any CPU - {8917A083-31A8-4954-8656-99385FF09237}.Debug|x86.ActiveCfg = Debug|Any CPU - {8917A083-31A8-4954-8656-99385FF09237}.Debug|x86.Build.0 = Debug|Any CPU - {8917A083-31A8-4954-8656-99385FF09237}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8917A083-31A8-4954-8656-99385FF09237}.Release|Any CPU.Build.0 = Release|Any CPU - {8917A083-31A8-4954-8656-99385FF09237}.Release|ARM.ActiveCfg = Release|Any CPU - {8917A083-31A8-4954-8656-99385FF09237}.Release|ARM.Build.0 = Release|Any CPU - {8917A083-31A8-4954-8656-99385FF09237}.Release|x64.ActiveCfg = Release|Any CPU - {8917A083-31A8-4954-8656-99385FF09237}.Release|x64.Build.0 = Release|Any CPU - {8917A083-31A8-4954-8656-99385FF09237}.Release|x86.ActiveCfg = Release|Any CPU - {8917A083-31A8-4954-8656-99385FF09237}.Release|x86.Build.0 = Release|Any CPU {A053E7BD-A78E-4C4C-A5FB-141C34DA8159}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A053E7BD-A78E-4C4C-A5FB-141C34DA8159}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A053E7BD-A78E-4C4C-A5FB-141C34DA8159}.Debug|ARM.ActiveCfg = Debug|Any CPU - {A053E7BD-A78E-4C4C-A5FB-141C34DA8159}.Debug|ARM.Build.0 = Debug|Any CPU - {A053E7BD-A78E-4C4C-A5FB-141C34DA8159}.Debug|x64.ActiveCfg = Debug|Any CPU - {A053E7BD-A78E-4C4C-A5FB-141C34DA8159}.Debug|x64.Build.0 = Debug|Any CPU - {A053E7BD-A78E-4C4C-A5FB-141C34DA8159}.Debug|x86.ActiveCfg = Debug|Any CPU - {A053E7BD-A78E-4C4C-A5FB-141C34DA8159}.Debug|x86.Build.0 = Debug|Any CPU {A053E7BD-A78E-4C4C-A5FB-141C34DA8159}.Release|Any CPU.ActiveCfg = Release|Any CPU {A053E7BD-A78E-4C4C-A5FB-141C34DA8159}.Release|Any CPU.Build.0 = Release|Any CPU - {A053E7BD-A78E-4C4C-A5FB-141C34DA8159}.Release|ARM.ActiveCfg = Release|Any CPU - {A053E7BD-A78E-4C4C-A5FB-141C34DA8159}.Release|ARM.Build.0 = Release|Any CPU - {A053E7BD-A78E-4C4C-A5FB-141C34DA8159}.Release|x64.ActiveCfg = Release|Any CPU - {A053E7BD-A78E-4C4C-A5FB-141C34DA8159}.Release|x64.Build.0 = Release|Any CPU - {A053E7BD-A78E-4C4C-A5FB-141C34DA8159}.Release|x86.ActiveCfg = Release|Any CPU - {A053E7BD-A78E-4C4C-A5FB-141C34DA8159}.Release|x86.Build.0 = Release|Any CPU {7422B848-AB65-4A37-BDB6-FEF98952A0D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7422B848-AB65-4A37-BDB6-FEF98952A0D4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7422B848-AB65-4A37-BDB6-FEF98952A0D4}.Debug|ARM.ActiveCfg = Debug|Any CPU - {7422B848-AB65-4A37-BDB6-FEF98952A0D4}.Debug|ARM.Build.0 = Debug|Any CPU - {7422B848-AB65-4A37-BDB6-FEF98952A0D4}.Debug|x64.ActiveCfg = Debug|Any CPU - {7422B848-AB65-4A37-BDB6-FEF98952A0D4}.Debug|x64.Build.0 = Debug|Any CPU - {7422B848-AB65-4A37-BDB6-FEF98952A0D4}.Debug|x86.ActiveCfg = Debug|Any CPU - {7422B848-AB65-4A37-BDB6-FEF98952A0D4}.Debug|x86.Build.0 = Debug|Any CPU {7422B848-AB65-4A37-BDB6-FEF98952A0D4}.Release|Any CPU.ActiveCfg = Release|Any CPU {7422B848-AB65-4A37-BDB6-FEF98952A0D4}.Release|Any CPU.Build.0 = Release|Any CPU - {7422B848-AB65-4A37-BDB6-FEF98952A0D4}.Release|ARM.ActiveCfg = Release|Any CPU - {7422B848-AB65-4A37-BDB6-FEF98952A0D4}.Release|ARM.Build.0 = Release|Any CPU - {7422B848-AB65-4A37-BDB6-FEF98952A0D4}.Release|x64.ActiveCfg = Release|Any CPU - {7422B848-AB65-4A37-BDB6-FEF98952A0D4}.Release|x64.Build.0 = Release|Any CPU - {7422B848-AB65-4A37-BDB6-FEF98952A0D4}.Release|x86.ActiveCfg = Release|Any CPU - {7422B848-AB65-4A37-BDB6-FEF98952A0D4}.Release|x86.Build.0 = Release|Any CPU {A2BE674A-D893-41B3-AC92-531DAF84A5E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A2BE674A-D893-41B3-AC92-531DAF84A5E5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A2BE674A-D893-41B3-AC92-531DAF84A5E5}.Debug|ARM.ActiveCfg = Debug|Any CPU - {A2BE674A-D893-41B3-AC92-531DAF84A5E5}.Debug|ARM.Build.0 = Debug|Any CPU - {A2BE674A-D893-41B3-AC92-531DAF84A5E5}.Debug|x64.ActiveCfg = Debug|Any CPU - {A2BE674A-D893-41B3-AC92-531DAF84A5E5}.Debug|x64.Build.0 = Debug|Any CPU - {A2BE674A-D893-41B3-AC92-531DAF84A5E5}.Debug|x86.ActiveCfg = Debug|Any CPU - {A2BE674A-D893-41B3-AC92-531DAF84A5E5}.Debug|x86.Build.0 = Debug|Any CPU {A2BE674A-D893-41B3-AC92-531DAF84A5E5}.Release|Any CPU.ActiveCfg = Release|Any CPU {A2BE674A-D893-41B3-AC92-531DAF84A5E5}.Release|Any CPU.Build.0 = Release|Any CPU - {A2BE674A-D893-41B3-AC92-531DAF84A5E5}.Release|ARM.ActiveCfg = Release|Any CPU - {A2BE674A-D893-41B3-AC92-531DAF84A5E5}.Release|ARM.Build.0 = Release|Any CPU - {A2BE674A-D893-41B3-AC92-531DAF84A5E5}.Release|x64.ActiveCfg = Release|Any CPU - {A2BE674A-D893-41B3-AC92-531DAF84A5E5}.Release|x64.Build.0 = Release|Any CPU - {A2BE674A-D893-41B3-AC92-531DAF84A5E5}.Release|x86.ActiveCfg = Release|Any CPU - {A2BE674A-D893-41B3-AC92-531DAF84A5E5}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {53CF9F37-5693-46EA-B722-0E083AE61582} = {D2690E5B-F1A4-4657-A45C-7D480D656268} - {AC23EF0B-D5BD-401E-A074-4072DCA935AC} = {D2690E5B-F1A4-4657-A45C-7D480D656268} - {25F76EE1-678A-4247-9697-5E5DAD3BB76E} = {D2690E5B-F1A4-4657-A45C-7D480D656268} - {8917A083-31A8-4954-8656-99385FF09237} = {D2690E5B-F1A4-4657-A45C-7D480D656268} - {A053E7BD-A78E-4C4C-A5FB-141C34DA8159} = {D2690E5B-F1A4-4657-A45C-7D480D656268} - {3C8ACE82-4738-477A-9270-328AB2D4356D} = {D2690E5B-F1A4-4657-A45C-7D480D656268} - {7422B848-AB65-4A37-BDB6-FEF98952A0D4} = {3C8ACE82-4738-477A-9270-328AB2D4356D} - {A2BE674A-D893-41B3-AC92-531DAF84A5E5} = {3C8ACE82-4738-477A-9270-328AB2D4356D} - EndGlobalSection EndGlobal diff --git a/NotifyPropertyChangedBase/NotifyPropertyChanged.cs b/NotifyPropertyChangedBase/NotifyPropertyChanged.cs index fdd3206..8915797 100644 --- a/NotifyPropertyChangedBase/NotifyPropertyChanged.cs +++ b/NotifyPropertyChangedBase/NotifyPropertyChanged.cs @@ -59,7 +59,6 @@ protected NotifyPropertyChanged() /// /// /// Parameter is null. - // Make changes in the NotifyPropertyChangedBase.Uap.rd file if you change something with the 'type' parameter protected void RegisterProperty(string name, Type type, object defaultValue) { RegisterProperty(name, type, defaultValue, null); @@ -84,7 +83,6 @@ protected void RegisterProperty(string name, Type type, object defaultValue) /// /// /// Parameter is null. - // Make changes in the NotifyPropertyChangedBase.Uap.rd file if you change something with the 'type' parameter protected void RegisterProperty(string name, Type type, object defaultValue, PropertyChangedCallbackHandler propertyChangedCallback) { Helpers.ValidateStringNotNullOrWhiteSpace(name, nameof(name)); From ff2f76bfaccb9b618a3a9e40c424f09b46846126 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Tue, 11 Jul 2017 22:44:36 +0200 Subject: [PATCH 035/118] Hopefully fixed .NET Standard patching [skip deployment] --- BeforeBuild.ps1 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/BeforeBuild.ps1 b/BeforeBuild.ps1 index ca6328e..1453cbe 100644 --- a/BeforeBuild.ps1 +++ b/BeforeBuild.ps1 @@ -33,9 +33,11 @@ foreach ($projectFolder in $projectFolders) { throw "Invalid csproj file path. `$xmlPath: '$xmlPath'" } - + $xml = [xml](Get-Content $xmlPath) - $propertyGroup = $xml.Project.PropertyGroup + + $propertyGroup = $xml | Select-Xml -XPath "/Project/PropertyGroup[Version='1.0.0']" + $propertyGroup = $propertyGroup.Node $propertyGroup.Version = $buildVersion $propertyGroup.AssemblyVersion = $buildVersion From b5bdeb0bd31b660fa09041b6ee255079fa98f144 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 13 Jul 2017 19:44:36 +0200 Subject: [PATCH 036/118] Added Codecov.io support [skip deployment] --- AfterBuild.ps1 => AppVeyor-AfterBuild.ps1 | 9 +++++++++ BeforeBuild.ps1 => AppVeyor-BeforeBuild.ps1 | 0 NotifyPropertyChangedBase.sln | 4 ++-- appveyor.yml | 1 + 4 files changed, 12 insertions(+), 2 deletions(-) rename AfterBuild.ps1 => AppVeyor-AfterBuild.ps1 (82%) rename BeforeBuild.ps1 => AppVeyor-BeforeBuild.ps1 (100%) diff --git a/AfterBuild.ps1 b/AppVeyor-AfterBuild.ps1 similarity index 82% rename from AfterBuild.ps1 rename to AppVeyor-AfterBuild.ps1 index 0305ede..dac9fc8 100644 --- a/AfterBuild.ps1 +++ b/AppVeyor-AfterBuild.ps1 @@ -66,3 +66,12 @@ if ($failed -ne 0) { throw "$failed of unit tests failed" } + +choco install opencover.portable +$target = "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe" +$targetArgs = "/testcontainer:""NotifyPropertyChangedBase.Tests.Net45\bin\Release\NotifyPropertyChangedBase.Tests.Net45.dll" +$filter = "+[NotifyPropertyChangedBase*]* -[NotifyPropertyChangedBase.Tests*]*" +$output = "OpenCoverResults.xml" + +OpenCover.Console.exe -target:$target -targetargs:$targetArgs -filter:$filter -output:$output +codecov -f $output diff --git a/BeforeBuild.ps1 b/AppVeyor-BeforeBuild.ps1 similarity index 100% rename from BeforeBuild.ps1 rename to AppVeyor-BeforeBuild.ps1 diff --git a/NotifyPropertyChangedBase.sln b/NotifyPropertyChangedBase.sln index b007189..2b8dccb 100644 --- a/NotifyPropertyChangedBase.sln +++ b/NotifyPropertyChangedBase.sln @@ -9,9 +9,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution ProjectSection(SolutionItems) = preProject .gitattributes = .gitattributes .gitignore = .gitignore - AfterBuild.ps1 = AfterBuild.ps1 + AppVeyor-AfterBuild.ps1 = AppVeyor-AfterBuild.ps1 + AppVeyor-BeforeBuild.ps1 = AppVeyor-BeforeBuild.ps1 appveyor.yml = appveyor.yml - BeforeBuild.ps1 = BeforeBuild.ps1 LICENSE.md = LICENSE.md NotifyPropertyChangedBase.nuspec = NotifyPropertyChangedBase.nuspec README.md = README.md diff --git a/appveyor.yml b/appveyor.yml index ac6a00f..eff1b6b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,6 +5,7 @@ branches: only: - master - dev + - codecov-preparations skip_tags: true skip_commits: files: From 92d5df4ac777f9ba8025b8beea3732823ad21e8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 13 Jul 2017 19:49:01 +0200 Subject: [PATCH 037/118] Fixed build scripts path [skip deployment] --- README.md | 1 + appveyor.yml | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2f7ecb9..a3f7c62 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # NotifyPropertyChangedBase [![NuGet](https://img.shields.io/nuget/v/NotifyPropertyChangedBase.svg)](https://www.nuget.org/packages/NotifyPropertyChangedBase/) [![Build status](https://ci.appveyor.com/api/projects/status/jc9gcr4gldjr8nq6/branch/master?svg=true)](https://ci.appveyor.com/project/bramborman/notifypropertychangedbase/branch/master) +[![codecov](https://codecov.io/gh/bramborman/NotifyPropertyChangedBase/branch/master/graph/badge.svg)](https://codecov.io/gh/bramborman/NotifyPropertyChangedBase) [![Issues](https://img.shields.io/github/issues/bramborman/NotifyPropertyChangedBase.svg)](https://github.com/bramborman/NotifyPropertyChangedBase/issues) [![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/bramborman/NotifyPropertyChangedBase/blob/master/LICENSE.md) diff --git a/appveyor.yml b/appveyor.yml index eff1b6b..c9db66a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -22,11 +22,11 @@ assembly_info: assembly_file_version: 1.2.2.{build} assembly_informational_version: 1.2.2.{build} before_build: -- ps: '& .\BeforeBuild.ps1' +- ps: '& .\AppVeyor-BeforeBuild.ps1' build: verbosity: minimal after_build: -- ps: '& .\AfterBuild.ps1' +- ps: '& .\AppVeyor-AfterBuild.ps1' deploy: - provider: Environment name: MyGet From 2958197f08b4194c879229eaeaf7f79112a62619 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 13 Jul 2017 19:52:21 +0200 Subject: [PATCH 038/118] It's not installed on AppVeyor by default? :( [skip deployment] --- AppVeyor-AfterBuild.ps1 | 8 +++++--- AppVeyor-BeforeBuild.ps1 | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/AppVeyor-AfterBuild.ps1 b/AppVeyor-AfterBuild.ps1 index dac9fc8..1442351 100644 --- a/AppVeyor-AfterBuild.ps1 +++ b/AppVeyor-AfterBuild.ps1 @@ -1,5 +1,5 @@ -Write-Host "`nAfterBuild script executed" -Write-Host "==========================" +Write-Host "`nAppVeyor-AfterBuild script executed" +Write-Host "===================================" Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildScripts/master/Scripts/Set-PureBuildVersion.ps1" .\Set-PureBuildVersion.ps1 @@ -67,11 +67,13 @@ if ($failed -ne 0) throw "$failed of unit tests failed" } -choco install opencover.portable $target = "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe" $targetArgs = "/testcontainer:""NotifyPropertyChangedBase.Tests.Net45\bin\Release\NotifyPropertyChangedBase.Tests.Net45.dll" $filter = "+[NotifyPropertyChangedBase*]* -[NotifyPropertyChangedBase.Tests*]*" $output = "OpenCoverResults.xml" +choco install opencover.portable OpenCover.Console.exe -target:$target -targetargs:$targetArgs -filter:$filter -output:$output + +choco install codecov codecov -f $output diff --git a/AppVeyor-BeforeBuild.ps1 b/AppVeyor-BeforeBuild.ps1 index 1453cbe..ac542d1 100644 --- a/AppVeyor-BeforeBuild.ps1 +++ b/AppVeyor-BeforeBuild.ps1 @@ -1,5 +1,5 @@ -Write-Host "`nBeforeBuild script executed" -Write-Host "===========================" +Write-Host "`nAppVeyor-BeforeBuild script executed" +Write-Host "====================================" Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildScripts/master/Scripts/Set-BuildVersion.ps1" .\Set-BuildVersion.ps1 From 5382574688d947dee887ad4e7d4de909208c4a47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 13 Jul 2017 20:29:30 +0200 Subject: [PATCH 039/118] Fixed opencover execution. I hope.. [skip deployment] --- AppVeyor-AfterBuild.ps1 | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/AppVeyor-AfterBuild.ps1 b/AppVeyor-AfterBuild.ps1 index 1442351..b1b8e63 100644 --- a/AppVeyor-AfterBuild.ps1 +++ b/AppVeyor-AfterBuild.ps1 @@ -69,11 +69,9 @@ if ($failed -ne 0) $target = "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe" $targetArgs = "/testcontainer:""NotifyPropertyChangedBase.Tests.Net45\bin\Release\NotifyPropertyChangedBase.Tests.Net45.dll" -$filter = "+[NotifyPropertyChangedBase*]* -[NotifyPropertyChangedBase.Tests*]*" +$filter = "`"+[NotifyPropertyChangedBase*]* -[NotifyPropertyChangedBase.Tests*]*`"" $output = "OpenCoverResults.xml" -choco install opencover.portable +choco install opencover.portable codecov OpenCover.Console.exe -target:$target -targetargs:$targetArgs -filter:$filter -output:$output - -choco install codecov codecov -f $output From af2e3197acd1d86df64717f4ae881af2c5e1ec8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 13 Jul 2017 21:10:31 +0200 Subject: [PATCH 040/118] What about this? [skip deployment] --- AppVeyor-AfterBuild.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AppVeyor-AfterBuild.ps1 b/AppVeyor-AfterBuild.ps1 index b1b8e63..a4d4175 100644 --- a/AppVeyor-AfterBuild.ps1 +++ b/AppVeyor-AfterBuild.ps1 @@ -67,7 +67,7 @@ if ($failed -ne 0) throw "$failed of unit tests failed" } -$target = "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe" +$target = "`"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe`"" $targetArgs = "/testcontainer:""NotifyPropertyChangedBase.Tests.Net45\bin\Release\NotifyPropertyChangedBase.Tests.Net45.dll" $filter = "`"+[NotifyPropertyChangedBase*]* -[NotifyPropertyChangedBase.Tests*]*`"" $output = "OpenCoverResults.xml" From 6698a8f916a7badf2fbbdc6366587d0ac66f0844 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 13 Jul 2017 21:13:17 +0200 Subject: [PATCH 041/118] Hmm? [skip deployment] --- AppVeyor-AfterBuild.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AppVeyor-AfterBuild.ps1 b/AppVeyor-AfterBuild.ps1 index a4d4175..02f3245 100644 --- a/AppVeyor-AfterBuild.ps1 +++ b/AppVeyor-AfterBuild.ps1 @@ -73,5 +73,5 @@ $filter = "`"+[NotifyPropertyChangedBase*]* -[NotifyPropertyChangedBase.Tests*]* $output = "OpenCoverResults.xml" choco install opencover.portable codecov -OpenCover.Console.exe -target:$target -targetargs:$targetArgs -filter:$filter -output:$output +& "OpenCover.Console.exe -target:$target -targetargs:$targetArgs -filter:$filter -output:$output" codecov -f $output From 04010b401dc750d2c2a4032deef2877f8e4c826d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 13 Jul 2017 21:20:43 +0200 Subject: [PATCH 042/118] This should work [skip deployment] --- AppVeyor-AfterBuild.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/AppVeyor-AfterBuild.ps1 b/AppVeyor-AfterBuild.ps1 index 02f3245..bdc8a2b 100644 --- a/AppVeyor-AfterBuild.ps1 +++ b/AppVeyor-AfterBuild.ps1 @@ -67,11 +67,11 @@ if ($failed -ne 0) throw "$failed of unit tests failed" } -$target = "`"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe`"" -$targetArgs = "/testcontainer:""NotifyPropertyChangedBase.Tests.Net45\bin\Release\NotifyPropertyChangedBase.Tests.Net45.dll" -$filter = "`"+[NotifyPropertyChangedBase*]* -[NotifyPropertyChangedBase.Tests*]*`"" +$target = """C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe""" +$targetArgs = "/testcontainer:""NotifyPropertyChangedBase.Tests.Net45\bin\Release\NotifyPropertyChangedBase.Tests.Net45.dll""" +$filter = """+[NotifyPropertyChangedBase*]* -[NotifyPropertyChangedBase.Tests*]*""" $output = "OpenCoverResults.xml" choco install opencover.portable codecov -& "OpenCover.Console.exe -target:$target -targetargs:$targetArgs -filter:$filter -output:$output" +OpenCover.Console.exe -target:$target -targetargs:$targetArgs -filter:$filter -output:$output codecov -f $output From 009b1d84e6a2dc3eaac52e416e084823e4d3796f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 13 Jul 2017 22:05:44 +0200 Subject: [PATCH 043/118] It'll maybe show the .NET Core test results in AppVeyor xD [skip deployment] --- AppVeyor-AfterBuild.ps1 | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/AppVeyor-AfterBuild.ps1 b/AppVeyor-AfterBuild.ps1 index bdc8a2b..2dd1204 100644 --- a/AppVeyor-AfterBuild.ps1 +++ b/AppVeyor-AfterBuild.ps1 @@ -42,30 +42,8 @@ Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildSc Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildScripts/master/Scripts/Deployment-Skipping.ps1" .\Deployment-Skipping.ps1 -dotnet vstest NotifyPropertyChangedBase.Tests.NetCore\bin\Release\netcoreapp1.0\NotifyPropertyChangedBase.Tests.NetCore.dll | Tee-Object -Variable testOutput -$results = $testOutput | Where-Object { $_.StartsWith("Total tests:") } -$counts = [Regex]::Matches($results, "\d+") | ForEach-Object { $_.Value } - -if ($counts.Count -ne 4) -{ - throw "Total number of numbers parsed is wrong. `$counts.Count: '$($counts.Count)'" -} - -$total = [int]$counts[0] -$passed = [int]$counts[1] -$failed = [int]$counts[2] -$skipped = [int]$counts[3] - -# Simple check whether we've parsed the results correctly -if ($total -ne ($passed + $failed + $skipped)) -{ - throw "Total number of test run was not the same as sum of test passed, failed and skipped." -} - -if ($failed -ne 0) -{ - throw "$failed of unit tests failed" -} +dotnet vstest NotifyPropertyChangedBase.Tests.NetCore\bin\Release\netcoreapp1.0\NotifyPropertyChangedBase.Tests.NetCore.dll /logger:trx +(New-Object "System.Net.WebClient").UploadFile("https://ci.appveyor.com/api/testresults/mstest/$env:APPVEYOR_JOB_ID", (Resolve-Path "NotifyPropertyChangedBase.Tests.NetCore\bin\Release\netcoreapp1.0\TestResults\*.trx")) $target = """C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe""" $targetArgs = "/testcontainer:""NotifyPropertyChangedBase.Tests.Net45\bin\Release\NotifyPropertyChangedBase.Tests.Net45.dll""" From c74f14509718766c9ce2b8b5e2c3591838b05d66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 13 Jul 2017 22:09:09 +0200 Subject: [PATCH 044/118] Why'm I so stupid.. -.- [skip deployment] --- AppVeyor-AfterBuild.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AppVeyor-AfterBuild.ps1 b/AppVeyor-AfterBuild.ps1 index 2dd1204..5fbc53e 100644 --- a/AppVeyor-AfterBuild.ps1 +++ b/AppVeyor-AfterBuild.ps1 @@ -43,7 +43,7 @@ Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildSc .\Deployment-Skipping.ps1 dotnet vstest NotifyPropertyChangedBase.Tests.NetCore\bin\Release\netcoreapp1.0\NotifyPropertyChangedBase.Tests.NetCore.dll /logger:trx -(New-Object "System.Net.WebClient").UploadFile("https://ci.appveyor.com/api/testresults/mstest/$env:APPVEYOR_JOB_ID", (Resolve-Path "NotifyPropertyChangedBase.Tests.NetCore\bin\Release\netcoreapp1.0\TestResults\*.trx")) +(New-Object "System.Net.WebClient").UploadFile("https://ci.appveyor.com/api/testresults/mstest/$env:APPVEYOR_JOB_ID", (Resolve-Path "TestResults\*.trx")) $target = """C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe""" $targetArgs = "/testcontainer:""NotifyPropertyChangedBase.Tests.Net45\bin\Release\NotifyPropertyChangedBase.Tests.Net45.dll""" From ea95da9f79f59c3dfcac2f5abdab6e5f5a117a9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 13 Jul 2017 22:18:36 +0200 Subject: [PATCH 045/118] Investigating codecov error.. --- AppVeyor-AfterBuild.ps1 | 2 ++ .../NotifyPropertyChangedBase.Tests.projitems | 2 +- .../{NotifyPropertyChangedTests.cs => Tests.cs} | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) rename NotifyPropertyChangedBase.Tests/{NotifyPropertyChangedTests.cs => Tests.cs} (97%) diff --git a/AppVeyor-AfterBuild.ps1 b/AppVeyor-AfterBuild.ps1 index 5fbc53e..e200930 100644 --- a/AppVeyor-AfterBuild.ps1 +++ b/AppVeyor-AfterBuild.ps1 @@ -53,3 +53,5 @@ $output = "OpenCoverResults.xml" choco install opencover.portable codecov OpenCover.Console.exe -target:$target -targetargs:$targetArgs -filter:$filter -output:$output codecov -f $output + +Write-Host (Get-Content $output) diff --git a/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedBase.Tests.projitems b/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedBase.Tests.projitems index e4b07c9..4b0876a 100644 --- a/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedBase.Tests.projitems +++ b/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedBase.Tests.projitems @@ -9,7 +9,7 @@ NotifyPropertyChangedBase.Tests - + \ No newline at end of file diff --git a/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedTests.cs b/NotifyPropertyChangedBase.Tests/Tests.cs similarity index 97% rename from NotifyPropertyChangedBase.Tests/NotifyPropertyChangedTests.cs rename to NotifyPropertyChangedBase.Tests/Tests.cs index fa2521a..85b3902 100644 --- a/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedTests.cs +++ b/NotifyPropertyChangedBase.Tests/Tests.cs @@ -4,7 +4,7 @@ namespace NotifyPropertyChangedBase.Tests { [TestClass] - public sealed class NotifyPropertyChangedTests + public sealed class Tests { [TestMethod] public void RegisterPropertyTests() From b439d78ed826f6d4972b60fa17697275edb4d136 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 13 Jul 2017 22:20:48 +0200 Subject: [PATCH 046/118] =?UTF-8?q?A=20commit=20for=20a=20good=20sleep=20?= =?UTF-8?q?=CA=A2=E2=97=89=E1=B4=A5=E2=97=89=CA=A1=20[skip=20deployment]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AppVeyor-AfterBuild.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AppVeyor-AfterBuild.ps1 b/AppVeyor-AfterBuild.ps1 index e200930..1724200 100644 --- a/AppVeyor-AfterBuild.ps1 +++ b/AppVeyor-AfterBuild.ps1 @@ -51,7 +51,7 @@ $filter = """+[NotifyPropertyChangedBase*]* -[NotifyPropertyChangedBase.Tests*]* $output = "OpenCoverResults.xml" choco install opencover.portable codecov -OpenCover.Console.exe -target:$target -targetargs:$targetArgs -filter:$filter -output:$output +OpenCover.Console.exe -register:user -target:$target -targetargs:$targetArgs -filter:$filter -output:$output codecov -f $output Write-Host (Get-Content $output) From 5f3619d44738d6cf4c9aba54b81f4cfdbe6ddeb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 13 Jul 2017 22:25:58 +0200 Subject: [PATCH 047/118] =?UTF-8?q?Goodnight=20GitHub=20[=20=EF=BE=9F?= =?UTF-8?q?=E1=8E=B2=20=EF=BE=9F]=20[skip=20deployment]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AppVeyor-AfterBuild.ps1 | 2 -- README.md | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/AppVeyor-AfterBuild.ps1 b/AppVeyor-AfterBuild.ps1 index 1724200..d6df962 100644 --- a/AppVeyor-AfterBuild.ps1 +++ b/AppVeyor-AfterBuild.ps1 @@ -53,5 +53,3 @@ $output = "OpenCoverResults.xml" choco install opencover.portable codecov OpenCover.Console.exe -register:user -target:$target -targetargs:$targetArgs -filter:$filter -output:$output codecov -f $output - -Write-Host (Get-Content $output) diff --git a/README.md b/README.md index a3f7c62..438a990 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ NotifyPropertyChangedBase provides you an easy to use base class `NotifyProperty ### Pre-release [![MyGet](https://img.shields.io/myget/bramborman/vpre/NotifyPropertyChangedBase.svg)][MyGet] [![Build status](https://ci.appveyor.com/api/projects/status/jc9gcr4gldjr8nq6/branch/dev?svg=true)](https://ci.appveyor.com/project/bramborman/notifypropertychangedbase/branch/dev) +[![codecov](https://codecov.io/gh/bramborman/NotifyPropertyChangedBase/branch/dev/graph/badge.svg)](https://codecov.io/gh/bramborman/NotifyPropertyChangedBase/branch/dev) If you want to get updates more frequently and you don't mind about the possibility of experiencing some bugs with this library sometimes, you can download the pre-release version of NotifyPropertyChangedBase from MyGet.org right [**here**][MyGet]. From 5e5efae6f15eaaf6ea188568bfcf0b39400cf7d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Fri, 14 Jul 2017 19:02:18 +0200 Subject: [PATCH 048/118] Bumped version to 1.3.0, minor changes --- NotifyPropertyChangedBase.nuspec | 2 +- NotifyPropertyChangedBase/NotifyPropertyChanged.cs | 10 ++++++---- appveyor.yml | 9 ++++----- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/NotifyPropertyChangedBase.nuspec b/NotifyPropertyChangedBase.nuspec index 95ba90b..2928bc9 100644 --- a/NotifyPropertyChangedBase.nuspec +++ b/NotifyPropertyChangedBase.nuspec @@ -13,7 +13,7 @@ NotifyPropertyChangedBase provides you an easy to use base class NotifyPropertyChanged that helps you implement the INotifyPropertyChanged interface which can help you in many cases, whether are you developing WPF, Console, UWP or any other app. Provides an easy to use base class NotifyPropertyChanged that helps you implement the INotifyPropertyChanged interface. © 2017 Marian Dolinský - C# Helper Helpers Binding Bindings MVVM + MVVM Binding Bindings Helper Helpers diff --git a/NotifyPropertyChangedBase/NotifyPropertyChanged.cs b/NotifyPropertyChangedBase/NotifyPropertyChanged.cs index 8915797..f19c4d0 100644 --- a/NotifyPropertyChangedBase/NotifyPropertyChanged.cs +++ b/NotifyPropertyChangedBase/NotifyPropertyChanged.cs @@ -164,8 +164,9 @@ protected object GetValue([CallerMemberName]string propertyName = null) } /// - /// Sets new value to a registered property even if it is equal and invokes the for the property if specified before - /// and if the value of is true and also invokes the event + /// Sets new value to a registered property even if it is equal to its current value and invokes the + /// for the property if specified before and if the value of is true + /// and also invokes the event /// if value of is true. /// /// New value for the property. @@ -191,8 +192,9 @@ protected void ForceSetValue(object value, [CallerMemberName]string propertyName } /// - /// Sets a new value to a registered property if it's not equal and invokes the for the property if specified before - /// and if the value of is true and also invokes the event + /// Sets a new value to a registered property if it's not equal to its current value and invokes the + /// for the property if specified before and if the value of is true + /// and also invokes the event /// if value of is true. /// /// New value for the property. diff --git a/appveyor.yml b/appveyor.yml index c9db66a..f9344f6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,11 +1,10 @@ -version: 1.2.2-{branch}{build} +version: 1.3.0-{branch}{build} pull_requests: do_not_increment_build_number: true branches: only: - master - dev - - codecov-preparations skip_tags: true skip_commits: files: @@ -18,9 +17,9 @@ configuration: Release assembly_info: patch: true file: SharedAssemblyInfo.cs - assembly_version: 1.2.2.{build} - assembly_file_version: 1.2.2.{build} - assembly_informational_version: 1.2.2.{build} + assembly_version: 1.3.0.{build} + assembly_file_version: 1.3.0.{build} + assembly_informational_version: 1.3.0.{build} before_build: - ps: '& .\AppVeyor-BeforeBuild.ps1' build: From 3e523f1b890385ac3d4b817c5b5101903ca6499b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Fri, 14 Jul 2017 20:04:05 +0200 Subject: [PATCH 049/118] Bugfix --- NotifyPropertyChangedBase/NotifyPropertyChanged.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/NotifyPropertyChangedBase/NotifyPropertyChanged.cs b/NotifyPropertyChangedBase/NotifyPropertyChanged.cs index f19c4d0..74759f4 100644 --- a/NotifyPropertyChangedBase/NotifyPropertyChanged.cs +++ b/NotifyPropertyChangedBase/NotifyPropertyChanged.cs @@ -218,18 +218,19 @@ protected void SetValue(object value, [CallerMemberName]string propertyName = nu { SetValue(value, propertyName, false); } - + private void SetValue(object value, string propertyName, bool forceSetValue) { PropertyData propertyData = GetPropertyData(propertyName, nameof(propertyName)); ValidateValueForType(value, propertyData.Type); - // Calling Equals calls the overriden method even when the current type is object - // Second check - calling .Equals on null will throw an exception ;) - if (forceSetValue || (propertyData.Value == null && value != null) || !propertyData.Value.Equals(value)) + // Calling Equals calls the overriden method even when the value is boxed + bool? valuesEqual = propertyData.Value?.Equals(value); + + if (forceSetValue || (valuesEqual == null && !ReferenceEquals(value, null)) || valuesEqual == false) { - object oldValue = propertyData.Value; - propertyData.Value = value; + object oldValue = propertyData.Value; + propertyData.Value = value; if (IsPropertyChangedCallbackInvokingEnabled) { From fa879ce452d539a0b20e9c73e04d349219860ff7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Sat, 15 Jul 2017 22:23:41 +0200 Subject: [PATCH 050/118] Moved NotifyPropertyChanged to one csproj [skip ci] --- .../NotifyPropertyChangedBase.Net40.csproj | 45 ------------------- .../Properties/AssemblyInfo.cs | 3 -- .../NotifyPropertyChangedBase.Net45.csproj | 45 ------------------- .../Properties/AssemblyInfo.cs | 3 -- ...tifyPropertyChangedBase.NetStandard.csproj | 27 ----------- ...tifyPropertyChangedBase.Tests.Net45.csproj | 9 ++-- .../Properties/AssemblyInfo.cs | 10 +++++ ...fyPropertyChangedBase.Tests.NetCore.csproj | 2 +- NotifyPropertyChangedBase.nuspec | 30 ------------- NotifyPropertyChangedBase.sln | 31 +++---------- .../NotifyPropertyChangedBase.csproj | 42 +++++++++++++++++ .../NotifyPropertyChangedBase.projitems | 15 ------- .../NotifyPropertyChangedBase.shproj | 13 ------ .../Properties/AssemblyInfo.cs | 3 ++ SharedAssemblyInfo.cs | 12 ----- 15 files changed, 65 insertions(+), 225 deletions(-) delete mode 100644 NotifyPropertyChangedBase.Net40/NotifyPropertyChangedBase.Net40.csproj delete mode 100644 NotifyPropertyChangedBase.Net40/Properties/AssemblyInfo.cs delete mode 100644 NotifyPropertyChangedBase.Net45/NotifyPropertyChangedBase.Net45.csproj delete mode 100644 NotifyPropertyChangedBase.Net45/Properties/AssemblyInfo.cs delete mode 100644 NotifyPropertyChangedBase.NetStandard/NotifyPropertyChangedBase.NetStandard.csproj delete mode 100644 NotifyPropertyChangedBase.nuspec create mode 100644 NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj delete mode 100644 NotifyPropertyChangedBase/NotifyPropertyChangedBase.projitems delete mode 100644 NotifyPropertyChangedBase/NotifyPropertyChangedBase.shproj create mode 100644 NotifyPropertyChangedBase/Properties/AssemblyInfo.cs delete mode 100644 SharedAssemblyInfo.cs diff --git a/NotifyPropertyChangedBase.Net40/NotifyPropertyChangedBase.Net40.csproj b/NotifyPropertyChangedBase.Net40/NotifyPropertyChangedBase.Net40.csproj deleted file mode 100644 index 58cc601..0000000 --- a/NotifyPropertyChangedBase.Net40/NotifyPropertyChangedBase.Net40.csproj +++ /dev/null @@ -1,45 +0,0 @@ - - - - - Debug - AnyCPU - {53CF9F37-5693-46EA-B722-0E083AE61582} - Library - Properties - NotifyPropertyChangedBase - NotifyPropertyChangedBase.Net40 - v4.0 - 512 - - - true - full - false - bin\Debug\ - TRACE;DEBUG;NET_40 - prompt - 4 - bin\Debug\NotifyPropertyChangedBase.Net40.xml - - - pdbonly - true - bin\Release\ - TRACE;NET_40 - prompt - 4 - bin\Release\NotifyPropertyChangedBase.Net40.xml - - - - - - - Properties\SharedAssemblyInfo.cs - - - - - - \ No newline at end of file diff --git a/NotifyPropertyChangedBase.Net40/Properties/AssemblyInfo.cs b/NotifyPropertyChangedBase.Net40/Properties/AssemblyInfo.cs deleted file mode 100644 index 5292c5c..0000000 --- a/NotifyPropertyChangedBase.Net40/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,3 +0,0 @@ -using System.Reflection; - -[assembly: AssemblyTitle("NotifyPropertyChangedBase.Net40")] diff --git a/NotifyPropertyChangedBase.Net45/NotifyPropertyChangedBase.Net45.csproj b/NotifyPropertyChangedBase.Net45/NotifyPropertyChangedBase.Net45.csproj deleted file mode 100644 index 2149569..0000000 --- a/NotifyPropertyChangedBase.Net45/NotifyPropertyChangedBase.Net45.csproj +++ /dev/null @@ -1,45 +0,0 @@ - - - - - Debug - AnyCPU - {AC23EF0B-D5BD-401E-A074-4072DCA935AC} - Library - Properties - NotifyPropertyChangedBase - NotifyPropertyChangedBase.Net45 - v4.5 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - bin\Debug\NotifyPropertyChangedBase.Net45.xml - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - bin\Release\NotifyPropertyChangedBase.Net45.xml - - - - - - - Properties\SharedAssemblyInfo.cs - - - - - - \ No newline at end of file diff --git a/NotifyPropertyChangedBase.Net45/Properties/AssemblyInfo.cs b/NotifyPropertyChangedBase.Net45/Properties/AssemblyInfo.cs deleted file mode 100644 index 38d1cf7..0000000 --- a/NotifyPropertyChangedBase.Net45/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,3 +0,0 @@ -using System.Reflection; - -[assembly: AssemblyTitle("NotifyPropertyChangedBase.Net45")] diff --git a/NotifyPropertyChangedBase.NetStandard/NotifyPropertyChangedBase.NetStandard.csproj b/NotifyPropertyChangedBase.NetStandard/NotifyPropertyChangedBase.NetStandard.csproj deleted file mode 100644 index a2ed78f..0000000 --- a/NotifyPropertyChangedBase.NetStandard/NotifyPropertyChangedBase.NetStandard.csproj +++ /dev/null @@ -1,27 +0,0 @@ - - - - netstandard1.0 - NotifyPropertyChangedBase - NotifyPropertyChangedBase - NotifyPropertyChangedBase - An easy to use base class that helps you implement the INotifyPropertyChanged interface. - Marian Dolinský - Marian Dolinský - © 2017 Marian Dolinský - 1.0.0 - 1.0.0.0 - 1.0.0.0 - - - - bin\Release\netstandard1.0\NotifyPropertyChangedBase.NetStandard.xml - - - - bin\Debug\netstandard1.0\NotifyPropertyChangedBase.NetStandard.xml - - - - - \ No newline at end of file diff --git a/NotifyPropertyChangedBase.Tests.Net45/NotifyPropertyChangedBase.Tests.Net45.csproj b/NotifyPropertyChangedBase.Tests.Net45/NotifyPropertyChangedBase.Tests.Net45.csproj index 0aa5527..a3104e3 100644 --- a/NotifyPropertyChangedBase.Tests.Net45/NotifyPropertyChangedBase.Tests.Net45.csproj +++ b/NotifyPropertyChangedBase.Tests.Net45/NotifyPropertyChangedBase.Tests.Net45.csproj @@ -48,18 +48,15 @@ - - Properties\SharedAssemblyInfo.cs - - - {ac23ef0b-d5bd-401e-a074-4072dca935ac} - NotifyPropertyChangedBase.Net45 + + {6781f993-6d8c-4107-994f-e942bb13fcfb} + NotifyPropertyChangedBase diff --git a/NotifyPropertyChangedBase.Tests.Net45/Properties/AssemblyInfo.cs b/NotifyPropertyChangedBase.Tests.Net45/Properties/AssemblyInfo.cs index f141ff8..f0a3511 100644 --- a/NotifyPropertyChangedBase.Tests.Net45/Properties/AssemblyInfo.cs +++ b/NotifyPropertyChangedBase.Tests.Net45/Properties/AssemblyInfo.cs @@ -1,3 +1,13 @@ using System.Reflection; +using System.Runtime.InteropServices; +[assembly: AssemblyProduct("NotifyPropertyChangedBase.Tests")] [assembly: AssemblyTitle("NotifyPropertyChangedBase.Tests.Net45")] +[assembly: AssemblyDescription("An easy to use base class that helps you implement the INotifyPropertyChanged interface.")] +[assembly: AssemblyCompany("Marian Dolinský")] +[assembly: AssemblyCopyright("© 2017 Marian Dolinský")] +// Managed in appveyor.yml +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyInformationalVersion("1.0.0.0")] +[assembly: ComVisible(false)] diff --git a/NotifyPropertyChangedBase.Tests.NetCore/NotifyPropertyChangedBase.Tests.NetCore.csproj b/NotifyPropertyChangedBase.Tests.NetCore/NotifyPropertyChangedBase.Tests.NetCore.csproj index e57f446..8816017 100644 --- a/NotifyPropertyChangedBase.Tests.NetCore/NotifyPropertyChangedBase.Tests.NetCore.csproj +++ b/NotifyPropertyChangedBase.Tests.NetCore/NotifyPropertyChangedBase.Tests.NetCore.csproj @@ -21,7 +21,7 @@ - + diff --git a/NotifyPropertyChangedBase.nuspec b/NotifyPropertyChangedBase.nuspec deleted file mode 100644 index 2928bc9..0000000 --- a/NotifyPropertyChangedBase.nuspec +++ /dev/null @@ -1,30 +0,0 @@ - - - - NotifyPropertyChangedBase - - 1.0.0.0 - NotifyPropertyChangedBase - Marian Dolinský - Marian Dolinský - https://github.com/bramborman/NotifyPropertyChangedBase/blob/master/LICENSE.md - https://github.com/bramborman/NotifyPropertyChangedBase - false - NotifyPropertyChangedBase provides you an easy to use base class NotifyPropertyChanged that helps you implement the INotifyPropertyChanged interface which can help you in many cases, whether are you developing WPF, Console, UWP or any other app. - Provides an easy to use base class NotifyPropertyChanged that helps you implement the INotifyPropertyChanged interface. - © 2017 Marian Dolinský - MVVM Binding Bindings Helper Helpers - - - - - - - - - - - - - - \ No newline at end of file diff --git a/NotifyPropertyChangedBase.sln b/NotifyPropertyChangedBase.sln index 2b8dccb..8bd86cf 100644 --- a/NotifyPropertyChangedBase.sln +++ b/NotifyPropertyChangedBase.sln @@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.26430.15 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "NotifyPropertyChangedBase", "NotifyPropertyChangedBase\NotifyPropertyChangedBase.shproj", "{036F1706-A135-46EA-A881-C2B334E9936D}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{121EBC4B-EA90-4A53-8E99-B56DA7C6646F}" ProjectSection(SolutionItems) = preProject .gitattributes = .gitattributes @@ -13,48 +11,27 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution AppVeyor-BeforeBuild.ps1 = AppVeyor-BeforeBuild.ps1 appveyor.yml = appveyor.yml LICENSE.md = LICENSE.md - NotifyPropertyChangedBase.nuspec = NotifyPropertyChangedBase.nuspec README.md = README.md - SharedAssemblyInfo.cs = SharedAssemblyInfo.cs EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotifyPropertyChangedBase.Net40", "NotifyPropertyChangedBase.Net40\NotifyPropertyChangedBase.Net40.csproj", "{53CF9F37-5693-46EA-B722-0E083AE61582}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotifyPropertyChangedBase.Net45", "NotifyPropertyChangedBase.Net45\NotifyPropertyChangedBase.Net45.csproj", "{AC23EF0B-D5BD-401E-A074-4072DCA935AC}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NotifyPropertyChangedBase.NetStandard", "NotifyPropertyChangedBase.NetStandard\NotifyPropertyChangedBase.NetStandard.csproj", "{A053E7BD-A78E-4C4C-A5FB-141C34DA8159}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotifyPropertyChangedBase.Tests.Net45", "NotifyPropertyChangedBase.Tests.Net45\NotifyPropertyChangedBase.Tests.Net45.csproj", "{7422B848-AB65-4A37-BDB6-FEF98952A0D4}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "NotifyPropertyChangedBase.Tests", "NotifyPropertyChangedBase.Tests\NotifyPropertyChangedBase.Tests.shproj", "{A5BFF919-D838-4B1B-ACD8-9F234304DB94}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NotifyPropertyChangedBase.Tests.NetCore", "NotifyPropertyChangedBase.Tests.NetCore\NotifyPropertyChangedBase.Tests.NetCore.csproj", "{A2BE674A-D893-41B3-AC92-531DAF84A5E5}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NotifyPropertyChangedBase", "NotifyPropertyChangedBase\NotifyPropertyChangedBase.csproj", "{6781F993-6D8C-4107-994F-E942BB13FCFB}" +EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution - NotifyPropertyChangedBase\NotifyPropertyChangedBase.projitems*{036f1706-a135-46ea-a881-c2b334e9936d}*SharedItemsImports = 13 - NotifyPropertyChangedBase\NotifyPropertyChangedBase.projitems*{53cf9f37-5693-46ea-b722-0e083ae61582}*SharedItemsImports = 4 NotifyPropertyChangedBase.Tests\NotifyPropertyChangedBase.Tests.projitems*{7422b848-ab65-4a37-bdb6-fef98952a0d4}*SharedItemsImports = 4 NotifyPropertyChangedBase.Tests\NotifyPropertyChangedBase.Tests.projitems*{a5bff919-d838-4b1b-acd8-9f234304db94}*SharedItemsImports = 13 - NotifyPropertyChangedBase\NotifyPropertyChangedBase.projitems*{ac23ef0b-d5bd-401e-a074-4072dca935ac}*SharedItemsImports = 4 EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {53CF9F37-5693-46EA-B722-0E083AE61582}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {53CF9F37-5693-46EA-B722-0E083AE61582}.Debug|Any CPU.Build.0 = Debug|Any CPU - {53CF9F37-5693-46EA-B722-0E083AE61582}.Release|Any CPU.ActiveCfg = Release|Any CPU - {53CF9F37-5693-46EA-B722-0E083AE61582}.Release|Any CPU.Build.0 = Release|Any CPU - {AC23EF0B-D5BD-401E-A074-4072DCA935AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AC23EF0B-D5BD-401E-A074-4072DCA935AC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AC23EF0B-D5BD-401E-A074-4072DCA935AC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AC23EF0B-D5BD-401E-A074-4072DCA935AC}.Release|Any CPU.Build.0 = Release|Any CPU - {A053E7BD-A78E-4C4C-A5FB-141C34DA8159}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A053E7BD-A78E-4C4C-A5FB-141C34DA8159}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A053E7BD-A78E-4C4C-A5FB-141C34DA8159}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A053E7BD-A78E-4C4C-A5FB-141C34DA8159}.Release|Any CPU.Build.0 = Release|Any CPU {7422B848-AB65-4A37-BDB6-FEF98952A0D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7422B848-AB65-4A37-BDB6-FEF98952A0D4}.Debug|Any CPU.Build.0 = Debug|Any CPU {7422B848-AB65-4A37-BDB6-FEF98952A0D4}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -63,6 +40,10 @@ Global {A2BE674A-D893-41B3-AC92-531DAF84A5E5}.Debug|Any CPU.Build.0 = Debug|Any CPU {A2BE674A-D893-41B3-AC92-531DAF84A5E5}.Release|Any CPU.ActiveCfg = Release|Any CPU {A2BE674A-D893-41B3-AC92-531DAF84A5E5}.Release|Any CPU.Build.0 = Release|Any CPU + {6781F993-6D8C-4107-994F-E942BB13FCFB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6781F993-6D8C-4107-994F-E942BB13FCFB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6781F993-6D8C-4107-994F-E942BB13FCFB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6781F993-6D8C-4107-994F-E942BB13FCFB}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj b/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj new file mode 100644 index 0000000..d057c9a --- /dev/null +++ b/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj @@ -0,0 +1,42 @@ + + + net45;net40;netstandard1.0; + NotifyPropertyChangedBase + NotifyPropertyChangedBase + NotifyPropertyChangedBase + NotifyPropertyChangedBase + NotifyPropertyChangedBase provides you an easy to use base class NotifyPropertyChanged that helps you implement the INotifyPropertyChanged interface which can help you in many cases, whether are you developing WPF, Console, UWP or any other app. + Base class that helps you implement the INotifyPropertyChanged interface. + Marian Dolinský + Marian Dolinský + © 2017 Marian Dolinský + 1.0.0 + 1.0.0.0 + 1.0.0.0 + MVVM Binding Bindings Helper Helpers + https://github.com/bramborman/NotifyPropertyChangedBase/blob/master/LICENSE.md + https://github.com/bramborman/NotifyPropertyChangedBase + https://github.com/bramborman/NotifyPropertyChangedBase + git + en-US + True + + + + + + NotifyPropertyChangedBase.Net45 + NotifyPropertyChangedBase.Net45 + NET_45;HAVE_COM_ATTRIBUTES + + + NotifyPropertyChangedBase.Net40 + NotifyPropertyChangedBase.Net40 + NET_40;HAVE_COM_ATTRIBUTES + + + NotifyPropertyChangedBase.NetStandard + NotifyPropertyChangedBase.NetStandard + NETSTANDARD1_0 + + diff --git a/NotifyPropertyChangedBase/NotifyPropertyChangedBase.projitems b/NotifyPropertyChangedBase/NotifyPropertyChangedBase.projitems deleted file mode 100644 index 4c18d4a..0000000 --- a/NotifyPropertyChangedBase/NotifyPropertyChangedBase.projitems +++ /dev/null @@ -1,15 +0,0 @@ - - - - $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - true - 036f1706-a135-46ea-a881-c2b334e9936d - - - NotifyPropertyChangedBase - - - - - - \ No newline at end of file diff --git a/NotifyPropertyChangedBase/NotifyPropertyChangedBase.shproj b/NotifyPropertyChangedBase/NotifyPropertyChangedBase.shproj deleted file mode 100644 index cb00569..0000000 --- a/NotifyPropertyChangedBase/NotifyPropertyChangedBase.shproj +++ /dev/null @@ -1,13 +0,0 @@ - - - - 036f1706-a135-46ea-a881-c2b334e9936d - 14.0 - - - - - - - - diff --git a/NotifyPropertyChangedBase/Properties/AssemblyInfo.cs b/NotifyPropertyChangedBase/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..fd779ac --- /dev/null +++ b/NotifyPropertyChangedBase/Properties/AssemblyInfo.cs @@ -0,0 +1,3 @@ +#if HAVE_COM_ATTRIBUTES +[assembly: System.Runtime.InteropServices.ComVisible(false)] +#endif diff --git a/SharedAssemblyInfo.cs b/SharedAssemblyInfo.cs deleted file mode 100644 index b24dd5c..0000000 --- a/SharedAssemblyInfo.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -[assembly: AssemblyProduct("NotifyPropertyChangedBase")] -[assembly: AssemblyDescription("An easy to use base class that helps you implement the INotifyPropertyChanged interface.")] -[assembly: AssemblyCompany("Marian Dolinský")] -[assembly: AssemblyCopyright("© 2017 Marian Dolinský")] -// Managed in appveyor.yml -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: AssemblyInformationalVersion("1.0.0.0")] -[assembly: ComVisible(false)] From 85c6133c08c74366bd81ec37efcf6e275cc84d70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Sat, 15 Jul 2017 22:49:12 +0200 Subject: [PATCH 051/118] NotifyPropertyChangedBase.Tests moved to one csproj [skip ci] --- ...tifyPropertyChangedBase.Tests.Net45.csproj | 73 ------------------- .../Properties/AssemblyInfo.cs | 13 ---- .../packages.config | 5 -- ...fyPropertyChangedBase.Tests.NetCore.csproj | 33 --------- .../NotifyPropertyChangedBase.Tests.csproj | 44 +++++++++++ .../NotifyPropertyChangedBase.Tests.projitems | 15 ---- .../NotifyPropertyChangedBase.Tests.shproj | 13 ---- NotifyPropertyChangedBase.sln | 25 ++----- .../NotifyPropertyChangedBase.csproj | 3 + .../AssemblyInfo.cs => SharedAssemblyInfo.cs | 0 10 files changed, 54 insertions(+), 170 deletions(-) delete mode 100644 NotifyPropertyChangedBase.Tests.Net45/NotifyPropertyChangedBase.Tests.Net45.csproj delete mode 100644 NotifyPropertyChangedBase.Tests.Net45/Properties/AssemblyInfo.cs delete mode 100644 NotifyPropertyChangedBase.Tests.Net45/packages.config delete mode 100644 NotifyPropertyChangedBase.Tests.NetCore/NotifyPropertyChangedBase.Tests.NetCore.csproj create mode 100644 NotifyPropertyChangedBase.Tests/NotifyPropertyChangedBase.Tests.csproj delete mode 100644 NotifyPropertyChangedBase.Tests/NotifyPropertyChangedBase.Tests.projitems delete mode 100644 NotifyPropertyChangedBase.Tests/NotifyPropertyChangedBase.Tests.shproj rename NotifyPropertyChangedBase/Properties/AssemblyInfo.cs => SharedAssemblyInfo.cs (100%) diff --git a/NotifyPropertyChangedBase.Tests.Net45/NotifyPropertyChangedBase.Tests.Net45.csproj b/NotifyPropertyChangedBase.Tests.Net45/NotifyPropertyChangedBase.Tests.Net45.csproj deleted file mode 100644 index a3104e3..0000000 --- a/NotifyPropertyChangedBase.Tests.Net45/NotifyPropertyChangedBase.Tests.Net45.csproj +++ /dev/null @@ -1,73 +0,0 @@ - - - - - Debug - AnyCPU - {7422B848-AB65-4A37-BDB6-FEF98952A0D4} - Library - Properties - NotifyPropertyChangedBase.Tests - NotifyPropertyChangedBase.Tests.Net45 - v4.5 - 512 - {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 15.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages - False - UnitTest - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - ..\packages\MSTest.TestFramework.1.1.18\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll - - - ..\packages\MSTest.TestFramework.1.1.18\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll - - - - - - - - - - - - - {6781f993-6d8c-4107-994f-e942bb13fcfb} - NotifyPropertyChangedBase - - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - \ No newline at end of file diff --git a/NotifyPropertyChangedBase.Tests.Net45/Properties/AssemblyInfo.cs b/NotifyPropertyChangedBase.Tests.Net45/Properties/AssemblyInfo.cs deleted file mode 100644 index f0a3511..0000000 --- a/NotifyPropertyChangedBase.Tests.Net45/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -[assembly: AssemblyProduct("NotifyPropertyChangedBase.Tests")] -[assembly: AssemblyTitle("NotifyPropertyChangedBase.Tests.Net45")] -[assembly: AssemblyDescription("An easy to use base class that helps you implement the INotifyPropertyChanged interface.")] -[assembly: AssemblyCompany("Marian Dolinský")] -[assembly: AssemblyCopyright("© 2017 Marian Dolinský")] -// Managed in appveyor.yml -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: AssemblyInformationalVersion("1.0.0.0")] -[assembly: ComVisible(false)] diff --git a/NotifyPropertyChangedBase.Tests.Net45/packages.config b/NotifyPropertyChangedBase.Tests.Net45/packages.config deleted file mode 100644 index fc2bbdd..0000000 --- a/NotifyPropertyChangedBase.Tests.Net45/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/NotifyPropertyChangedBase.Tests.NetCore/NotifyPropertyChangedBase.Tests.NetCore.csproj b/NotifyPropertyChangedBase.Tests.NetCore/NotifyPropertyChangedBase.Tests.NetCore.csproj deleted file mode 100644 index 8816017..0000000 --- a/NotifyPropertyChangedBase.Tests.NetCore/NotifyPropertyChangedBase.Tests.NetCore.csproj +++ /dev/null @@ -1,33 +0,0 @@ - - - - netcoreapp1.0 - NotifyPropertyChangedBase.Tests - NotifyPropertyChangedBase - NotifyPropertyChangedBase.Tests - An easy to use base class that helps you implement the INotifyPropertyChanged interface. - Marian Dolinský - Marian Dolinský - © 2017 Marian Dolinský - 1.0.0 - 1.0.0.0 - 1.0.0.0 - - - - - - - - - - - - - - - - - - - diff --git a/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedBase.Tests.csproj b/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedBase.Tests.csproj new file mode 100644 index 0000000..dc557a7 --- /dev/null +++ b/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedBase.Tests.csproj @@ -0,0 +1,44 @@ + + + net45;netcoreapp1.0; + NotifyPropertyChangedBase.Tests + NotifyPropertyChangedBase.Tests + NotifyPropertyChangedBase.Tests + NotifyPropertyChangedBase.Tests + Marian Dolinský + Marian Dolinský + © 2017 Marian Dolinský + 1.0.0 + 1.0.0.0 + 1.0.0.0 + https://github.com/bramborman/NotifyPropertyChangedBase + git + en-US + + + + + + + + + + + + + + + + + + + NotifyPropertyChangedBase.Tests.Net45 + NotifyPropertyChangedBase.Tests.Net45 + NET_45;HAVE_COM_ATTRIBUTES + + + NotifyPropertyChangedBase.Tests.NetCore + NotifyPropertyChangedBase.Tests.NetCore + NETCOREAPP1_0 + + diff --git a/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedBase.Tests.projitems b/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedBase.Tests.projitems deleted file mode 100644 index 4b0876a..0000000 --- a/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedBase.Tests.projitems +++ /dev/null @@ -1,15 +0,0 @@ - - - - $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - true - a5bff919-d838-4b1b-acd8-9f234304db94 - - - NotifyPropertyChangedBase.Tests - - - - - - \ No newline at end of file diff --git a/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedBase.Tests.shproj b/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedBase.Tests.shproj deleted file mode 100644 index 4fd2017..0000000 --- a/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedBase.Tests.shproj +++ /dev/null @@ -1,13 +0,0 @@ - - - - a5bff919-d838-4b1b-acd8-9f234304db94 - 14.0 - - - - - - - - diff --git a/NotifyPropertyChangedBase.sln b/NotifyPropertyChangedBase.sln index 8bd86cf..e04f7fd 100644 --- a/NotifyPropertyChangedBase.sln +++ b/NotifyPropertyChangedBase.sln @@ -12,38 +12,27 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution appveyor.yml = appveyor.yml LICENSE.md = LICENSE.md README.md = README.md + SharedAssemblyInfo.cs = SharedAssemblyInfo.cs EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotifyPropertyChangedBase.Tests.Net45", "NotifyPropertyChangedBase.Tests.Net45\NotifyPropertyChangedBase.Tests.Net45.csproj", "{7422B848-AB65-4A37-BDB6-FEF98952A0D4}" -EndProject -Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "NotifyPropertyChangedBase.Tests", "NotifyPropertyChangedBase.Tests\NotifyPropertyChangedBase.Tests.shproj", "{A5BFF919-D838-4B1B-ACD8-9F234304DB94}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NotifyPropertyChangedBase.Tests.NetCore", "NotifyPropertyChangedBase.Tests.NetCore\NotifyPropertyChangedBase.Tests.NetCore.csproj", "{A2BE674A-D893-41B3-AC92-531DAF84A5E5}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NotifyPropertyChangedBase", "NotifyPropertyChangedBase\NotifyPropertyChangedBase.csproj", "{6781F993-6D8C-4107-994F-E942BB13FCFB}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NotifyPropertyChangedBase.Tests", "NotifyPropertyChangedBase.Tests\NotifyPropertyChangedBase.Tests.csproj", "{22A1B2AF-E249-4B07-91DC-5C3E80D0567B}" +EndProject Global - GlobalSection(SharedMSBuildProjectFiles) = preSolution - NotifyPropertyChangedBase.Tests\NotifyPropertyChangedBase.Tests.projitems*{7422b848-ab65-4a37-bdb6-fef98952a0d4}*SharedItemsImports = 4 - NotifyPropertyChangedBase.Tests\NotifyPropertyChangedBase.Tests.projitems*{a5bff919-d838-4b1b-acd8-9f234304db94}*SharedItemsImports = 13 - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {7422B848-AB65-4A37-BDB6-FEF98952A0D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7422B848-AB65-4A37-BDB6-FEF98952A0D4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7422B848-AB65-4A37-BDB6-FEF98952A0D4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7422B848-AB65-4A37-BDB6-FEF98952A0D4}.Release|Any CPU.Build.0 = Release|Any CPU - {A2BE674A-D893-41B3-AC92-531DAF84A5E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A2BE674A-D893-41B3-AC92-531DAF84A5E5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A2BE674A-D893-41B3-AC92-531DAF84A5E5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A2BE674A-D893-41B3-AC92-531DAF84A5E5}.Release|Any CPU.Build.0 = Release|Any CPU {6781F993-6D8C-4107-994F-E942BB13FCFB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6781F993-6D8C-4107-994F-E942BB13FCFB}.Debug|Any CPU.Build.0 = Debug|Any CPU {6781F993-6D8C-4107-994F-E942BB13FCFB}.Release|Any CPU.ActiveCfg = Release|Any CPU {6781F993-6D8C-4107-994F-E942BB13FCFB}.Release|Any CPU.Build.0 = Release|Any CPU + {22A1B2AF-E249-4B07-91DC-5C3E80D0567B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {22A1B2AF-E249-4B07-91DC-5C3E80D0567B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {22A1B2AF-E249-4B07-91DC-5C3E80D0567B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {22A1B2AF-E249-4B07-91DC-5C3E80D0567B}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj b/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj index d057c9a..443460c 100644 --- a/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj +++ b/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj @@ -24,6 +24,9 @@ + + + NotifyPropertyChangedBase.Net45 NotifyPropertyChangedBase.Net45 diff --git a/NotifyPropertyChangedBase/Properties/AssemblyInfo.cs b/SharedAssemblyInfo.cs similarity index 100% rename from NotifyPropertyChangedBase/Properties/AssemblyInfo.cs rename to SharedAssemblyInfo.cs From f3927d157b340979df0234b9d623acd89c8e5d5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Sat, 15 Jul 2017 23:35:49 +0200 Subject: [PATCH 052/118] AppVeyor build should work now --- AppVeyor-BeforeBuild.ps1 | 52 -------------- AppVeyor-AfterBuild.ps1 => AppVeyor-Build.ps1 | 68 +++++++++++++------ .../NotifyPropertyChangedBase.Tests.csproj | 5 +- NotifyPropertyChangedBase.sln | 3 +- .../NotifyPropertyChangedBase.csproj | 3 +- appveyor.yml | 15 +--- 6 files changed, 57 insertions(+), 89 deletions(-) delete mode 100644 AppVeyor-BeforeBuild.ps1 rename AppVeyor-AfterBuild.ps1 => AppVeyor-Build.ps1 (50%) diff --git a/AppVeyor-BeforeBuild.ps1 b/AppVeyor-BeforeBuild.ps1 deleted file mode 100644 index ac542d1..0000000 --- a/AppVeyor-BeforeBuild.ps1 +++ /dev/null @@ -1,52 +0,0 @@ -Write-Host "`nAppVeyor-BeforeBuild script executed" -Write-Host "====================================" - -Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildScripts/master/Scripts/Set-BuildVersion.ps1" -.\Set-BuildVersion.ps1 - -Start-FileDownload "https://dist.nuget.org/win-x86-commandline/v4.1.0/nuget.exe" -.\nuget restore - -if($LastExitCode -ne 0) -{ - $host.SetShouldExit($LastExitCode) -} - -# Patch .NET Core and .NET Standard -Install-Module -Name powershell-yaml -Force - -if($LastExitCode -ne 0) -{ - $host.SetShouldExit($LastExitCode) -} - -$yaml = Get-Content .\appveyor.yml -Raw -$appveyorConfig = ConvertFrom-Yaml $yaml -$buildVersion = $appveyorConfig.assembly_info.assembly_version.Replace("{build}", $env:APPVEYOR_BUILD_NUMBER) -$projectFolders = Get-ChildItem -Include "*.NetCore","*.NetStandard" -Directory -Recurse - -foreach ($projectFolder in $projectFolders) -{ - $xmlPath = Join-Path $projectFolder.FullName "$($projectFolder.Name).csproj" - - if ((!(Test-Path $xmlPath)) -or (!($xmlPath.EndsWith(".csproj")))) - { - throw "Invalid csproj file path. `$xmlPath: '$xmlPath'" - } - - $xml = [xml](Get-Content $xmlPath) - - $propertyGroup = $xml | Select-Xml -XPath "/Project/PropertyGroup[Version='1.0.0']" - $propertyGroup = $propertyGroup.Node - - $propertyGroup.Version = $buildVersion - $propertyGroup.AssemblyVersion = $buildVersion - $propertyGroup.FileVersion = $buildVersion - - $xml.Save($xmlPath) -} - -if($LastExitCode -ne 0) -{ - $host.SetShouldExit($LastExitCode) -} diff --git a/AppVeyor-AfterBuild.ps1 b/AppVeyor-Build.ps1 similarity index 50% rename from AppVeyor-AfterBuild.ps1 rename to AppVeyor-Build.ps1 index d6df962..5f68e50 100644 --- a/AppVeyor-AfterBuild.ps1 +++ b/AppVeyor-Build.ps1 @@ -1,30 +1,56 @@ -Write-Host "`nAppVeyor-AfterBuild script executed" -Write-Host "===================================" +Write-Host "`nAppVeyor-Build script executed" +Write-Host "==============================" + +Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildScripts/master/Scripts/Set-BuildVersion.ps1" +.\Set-BuildVersion.ps1 Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildScripts/master/Scripts/Set-PureBuildVersion.ps1" .\Set-PureBuildVersion.ps1 +# Versions patching + +Install-Module -Name powershell-yaml -Force + +if($LastExitCode -ne 0) +{ + $host.SetShouldExit($LastExitCode) +} + +$yaml = Get-Content .\appveyor.yml -Raw +$appveyorConfig = ConvertFrom-Yaml $yaml +$buildVersion = $appveyorConfig.version.Replace("{branch}", $null).Replace("{build}", $env:APPVEYOR_BUILD_NUMBER) +$projectFiles = Get-ChildItem -Include "*.csproj" -Recurse + +foreach ($projectFile in $projectFiles) +{ + $xml = [xml](Get-Content $projectFile.FullName) + + $propertyGroup = $xml | Select-Xml -XPath "/Project/PropertyGroup[Version='1.0.0']" + $propertyGroup = $propertyGroup.Node + + $propertyGroup.Version = $buildVersion + $propertyGroup.FileVersion = $buildVersion + $propertyGroup.AssemblyVersion = $buildVersion + $propertyGroup.PackageVersion = $env:APPVEYOR_BUILD_VERSION + + $xml.Save($projectFile.FullName) + + if($LastExitCode -ne 0) + { + $host.SetShouldExit($LastExitCode) + } +} + +dotnet pack NotifyPropertyChangedBase\NotifyPropertyChangedBase.csproj -c Release -o $(Get-Location) +Push-AppveyorArtifact *.nupkg + +# Artifacts $projectFolders = Get-ChildItem -Directory -Filter "NotifyPropertyChangedBase*" foreach ($projectFolder in $projectFolders) { - # Skip the Shared projects - if (($projectFolder.Name -eq "NotifyPropertyChangedBase") -or ($projectFolder.Name -eq "NotifyPropertyChangedBase.Tests")) - { - continue; - } - $releaseFolder = Join-Path $projectFolder.FullName "\bin\Release" - if (Test-Path "$releaseFolder\netcoreapp1.0") - { - $releaseFolder = Join-Path $releaseFolder "\netcoreapp1.0" - } - elseif (Test-Path "$releaseFolder\netstandard1.0") - { - $releaseFolder = Join-Path $releaseFolder "\netstandard1.0" - } - if (!(Test-Path $releaseFolder)) { throw "Invalid project release folder. `$releaseFolder: '$releaseFolder'" @@ -36,15 +62,15 @@ foreach ($projectFolder in $projectFolders) Push-AppveyorArtifact $zipFileName } -Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildScripts/master/Scripts/NuGet-Pack.ps1" -.\NuGet-Pack.ps1 - +# Deployment skipping Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildScripts/master/Scripts/Deployment-Skipping.ps1" .\Deployment-Skipping.ps1 -dotnet vstest NotifyPropertyChangedBase.Tests.NetCore\bin\Release\netcoreapp1.0\NotifyPropertyChangedBase.Tests.NetCore.dll /logger:trx +# NETCore tests +dotnet vstest NotifyPropertyChangedBase.Tests\bin\Release\netcoreapp1.0\NotifyPropertyChangedBase.Tests.NetCore.dll /logger:trx (New-Object "System.Net.WebClient").UploadFile("https://ci.appveyor.com/api/testresults/mstest/$env:APPVEYOR_JOB_ID", (Resolve-Path "TestResults\*.trx")) +# Codecov $target = """C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe""" $targetArgs = "/testcontainer:""NotifyPropertyChangedBase.Tests.Net45\bin\Release\NotifyPropertyChangedBase.Tests.Net45.dll""" $filter = """+[NotifyPropertyChangedBase*]* -[NotifyPropertyChangedBase.Tests*]*""" diff --git a/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedBase.Tests.csproj b/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedBase.Tests.csproj index dc557a7..bc66cae 100644 --- a/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedBase.Tests.csproj +++ b/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedBase.Tests.csproj @@ -9,8 +9,8 @@ Marian Dolinský © 2017 Marian Dolinský 1.0.0 - 1.0.0.0 1.0.0.0 + 1.0.0.0 https://github.com/bramborman/NotifyPropertyChangedBase git en-US @@ -18,6 +18,9 @@ + + + diff --git a/NotifyPropertyChangedBase.sln b/NotifyPropertyChangedBase.sln index e04f7fd..7832328 100644 --- a/NotifyPropertyChangedBase.sln +++ b/NotifyPropertyChangedBase.sln @@ -7,8 +7,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution ProjectSection(SolutionItems) = preProject .gitattributes = .gitattributes .gitignore = .gitignore - AppVeyor-AfterBuild.ps1 = AppVeyor-AfterBuild.ps1 - AppVeyor-BeforeBuild.ps1 = AppVeyor-BeforeBuild.ps1 + AppVeyor-Build.ps1 = AppVeyor-Build.ps1 appveyor.yml = appveyor.yml LICENSE.md = LICENSE.md README.md = README.md diff --git a/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj b/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj index 443460c..13801e5 100644 --- a/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj +++ b/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj @@ -11,8 +11,9 @@ Marian Dolinský © 2017 Marian Dolinský 1.0.0 - 1.0.0.0 1.0.0.0 + 1.0.0 + 1.0.0.0 MVVM Binding Bindings Helper Helpers https://github.com/bramborman/NotifyPropertyChangedBase/blob/master/LICENSE.md https://github.com/bramborman/NotifyPropertyChangedBase diff --git a/appveyor.yml b/appveyor.yml index f9344f6..9ab9bc5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,6 +5,7 @@ branches: only: - master - dev + - a-single-csproj skip_tags: true skip_commits: files: @@ -14,18 +15,8 @@ skip_commits: - README.md image: Visual Studio 2017 configuration: Release -assembly_info: - patch: true - file: SharedAssemblyInfo.cs - assembly_version: 1.3.0.{build} - assembly_file_version: 1.3.0.{build} - assembly_informational_version: 1.3.0.{build} -before_build: -- ps: '& .\AppVeyor-BeforeBuild.ps1' -build: - verbosity: minimal -after_build: -- ps: '& .\AppVeyor-AfterBuild.ps1' +build_script: +- ps: '& .\AppVeyor-Build.ps1' deploy: - provider: Environment name: MyGet From bccdcfe00de5dafe46b219c8d07ac7ce36f88af9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Sat, 15 Jul 2017 23:43:47 +0200 Subject: [PATCH 053/118] =?UTF-8?q?Fixed=20build=3F=20(=20=CD=A1=C2=B0=20?= =?UTF-8?q?=CD=9C=CA=96=20=CD=A1=C2=B0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AppVeyor-Build.ps1 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/AppVeyor-Build.ps1 b/AppVeyor-Build.ps1 index 5f68e50..1d9cb6e 100644 --- a/AppVeyor-Build.ps1 +++ b/AppVeyor-Build.ps1 @@ -31,7 +31,11 @@ foreach ($projectFile in $projectFiles) $propertyGroup.Version = $buildVersion $propertyGroup.FileVersion = $buildVersion $propertyGroup.AssemblyVersion = $buildVersion - $propertyGroup.PackageVersion = $env:APPVEYOR_BUILD_VERSION + + if (!($projectFile.Name.Contains("Tests"))) + { + $propertyGroup.PackageVersion = $env:APPVEYOR_BUILD_VERSION + } $xml.Save($projectFile.FullName) @@ -41,7 +45,10 @@ foreach ($projectFile in $projectFiles) } } +# Build dotnet pack NotifyPropertyChangedBase\NotifyPropertyChangedBase.csproj -c Release -o $(Get-Location) +dotnet build NotifyPropertyChangedBase.Tests\NotifyPropertyChangedBase.Tests.csproj -c Release + Push-AppveyorArtifact *.nupkg # Artifacts From 109357e8af4657e4573f0b2c80a8b9d56d6bcccd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Sat, 15 Jul 2017 23:47:26 +0200 Subject: [PATCH 054/118] More fixes for your pleasure :3 --- AppVeyor-Build.ps1 | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/AppVeyor-Build.ps1 b/AppVeyor-Build.ps1 index 1d9cb6e..3a069f3 100644 --- a/AppVeyor-Build.ps1 +++ b/AppVeyor-Build.ps1 @@ -1,14 +1,11 @@ -Write-Host "`nAppVeyor-Build script executed" -Write-Host "==============================" - -Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildScripts/master/Scripts/Set-BuildVersion.ps1" +Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildScripts/master/Scripts/Set-BuildVersion.ps1" .\Set-BuildVersion.ps1 Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildScripts/master/Scripts/Set-PureBuildVersion.ps1" .\Set-PureBuildVersion.ps1 -# Versions patching - +Write-Host "`nVersions patching" +Write-Host "=================" Install-Module -Name powershell-yaml -Force if($LastExitCode -ne 0) @@ -45,13 +42,16 @@ foreach ($projectFile in $projectFiles) } } -# Build +Write-Host "`nBuild" +Write-Host "=====" +dotnet restore dotnet pack NotifyPropertyChangedBase\NotifyPropertyChangedBase.csproj -c Release -o $(Get-Location) dotnet build NotifyPropertyChangedBase.Tests\NotifyPropertyChangedBase.Tests.csproj -c Release Push-AppveyorArtifact *.nupkg -# Artifacts +Write-Host "`nArtifacts" +Write-Host "=========" $projectFolders = Get-ChildItem -Directory -Filter "NotifyPropertyChangedBase*" foreach ($projectFolder in $projectFolders) @@ -69,15 +69,16 @@ foreach ($projectFolder in $projectFolders) Push-AppveyorArtifact $zipFileName } -# Deployment skipping Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildScripts/master/Scripts/Deployment-Skipping.ps1" .\Deployment-Skipping.ps1 -# NETCore tests +Write-Host "`n.NET Core tests" +Write-Host "===============" dotnet vstest NotifyPropertyChangedBase.Tests\bin\Release\netcoreapp1.0\NotifyPropertyChangedBase.Tests.NetCore.dll /logger:trx (New-Object "System.Net.WebClient").UploadFile("https://ci.appveyor.com/api/testresults/mstest/$env:APPVEYOR_JOB_ID", (Resolve-Path "TestResults\*.trx")) -# Codecov +Write-Host "`nCodecov" +Write-Host "=======" $target = """C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe""" $targetArgs = "/testcontainer:""NotifyPropertyChangedBase.Tests.Net45\bin\Release\NotifyPropertyChangedBase.Tests.Net45.dll""" $filter = """+[NotifyPropertyChangedBase*]* -[NotifyPropertyChangedBase.Tests*]*""" From 79bc0d31015b982ec529ecfd90235831cea31b87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Sat, 15 Jul 2017 23:57:34 +0200 Subject: [PATCH 055/118] Investigating [skip deployment] --- appveyor.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index 9ab9bc5..ee3b7fd 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -32,3 +32,9 @@ deploy: on: branch: master SKIP_DEPLOYMENT: false ++####### + +init: + + - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) + +on_finish: + + - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) + +####### From a6b2e297519eb2b9df8f11211799fa2e55f799f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Sun, 16 Jul 2017 00:00:26 +0200 Subject: [PATCH 056/118] I should've read that before.. [skip deployment] --- appveyor.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index ee3b7fd..91fd055 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -14,7 +14,6 @@ skip_commits: - LICENSE.md - README.md image: Visual Studio 2017 -configuration: Release build_script: - ps: '& .\AppVeyor-Build.ps1' deploy: @@ -32,9 +31,9 @@ deploy: on: branch: master SKIP_DEPLOYMENT: false -+####### - +init: - + - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) - +on_finish: - + - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) - +####### +####### +init: + - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) +on_finish: + - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) +####### From 1b9b024604569b71f1a551cbb69f5a301bb67f3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Sun, 16 Jul 2017 00:18:56 +0200 Subject: [PATCH 057/118] =?UTF-8?q?Finally=20^=E2=80=BF^?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AppVeyor-Build.ps1 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/AppVeyor-Build.ps1 b/AppVeyor-Build.ps1 index 3a069f3..8e03ad7 100644 --- a/AppVeyor-Build.ps1 +++ b/AppVeyor-Build.ps1 @@ -15,7 +15,7 @@ if($LastExitCode -ne 0) $yaml = Get-Content .\appveyor.yml -Raw $appveyorConfig = ConvertFrom-Yaml $yaml -$buildVersion = $appveyorConfig.version.Replace("{branch}", $null).Replace("{build}", $env:APPVEYOR_BUILD_NUMBER) +$buildVersion = $appveyorConfig.version.Replace('-', '.').Replace("{branch}", $null).Replace("{build}", $env:APPVEYOR_BUILD_NUMBER) $projectFiles = Get-ChildItem -Include "*.csproj" -Recurse foreach ($projectFile in $projectFiles) @@ -46,12 +46,15 @@ Write-Host "`nBuild" Write-Host "=====" dotnet restore dotnet pack NotifyPropertyChangedBase\NotifyPropertyChangedBase.csproj -c Release -o $(Get-Location) -dotnet build NotifyPropertyChangedBase.Tests\NotifyPropertyChangedBase.Tests.csproj -c Release -Push-AppveyorArtifact *.nupkg +Write-Host "`nTests Build" +Write-Host "===========" +dotnet build NotifyPropertyChangedBase.Tests\NotifyPropertyChangedBase.Tests.csproj -c Release Write-Host "`nArtifacts" Write-Host "=========" + +Push-AppveyorArtifact *.nupkg $projectFolders = Get-ChildItem -Directory -Filter "NotifyPropertyChangedBase*" foreach ($projectFolder in $projectFolders) From a1c28d913adaf525ec90150ca3f84dfa7d450a4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Sun, 16 Jul 2017 00:20:11 +0200 Subject: [PATCH 058/118] AARRRGGGHHH --- appveyor.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 91fd055..feae2f4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -31,9 +31,3 @@ deploy: on: branch: master SKIP_DEPLOYMENT: false -####### -init: - - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) -on_finish: - - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) -####### From f1c02c9933ebf65d3a3a5962b02fed265466b620 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Sun, 16 Jul 2017 22:02:49 +0200 Subject: [PATCH 059/118] Testing PCL - closes #15 --- .../NotifyPropertyChangedBase.csproj | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj b/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj index 13801e5..6cc24f0 100644 --- a/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj +++ b/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj @@ -1,6 +1,6 @@  - net45;net40;netstandard1.0; + net45;net40;netstandard1.0;portable-net451+netcore451; NotifyPropertyChangedBase NotifyPropertyChangedBase NotifyPropertyChangedBase @@ -43,4 +43,14 @@ NotifyPropertyChangedBase.NetStandard NETSTANDARD1_0 + + NotifyPropertyChangedBase.Portable + NotifyPropertyChangedBase.Portable + NET_PORTABLE_44 + .NETPortable + v4.6 + Profile44 + .NETPortable,Version=v0.0,Profile=Profile44 + $(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets + From 08fd6e90b1e90da7718d2aea12b2ab62cfd750e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Mon, 17 Jul 2017 19:39:31 +0200 Subject: [PATCH 060/118] Trying to fix the build [skip deployment] --- AppVeyor-Build.ps1 | 8 ++------ .../NotifyPropertyChangedBase.csproj | 12 ++++++------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/AppVeyor-Build.ps1 b/AppVeyor-Build.ps1 index 8e03ad7..389fa4f 100644 --- a/AppVeyor-Build.ps1 +++ b/AppVeyor-Build.ps1 @@ -44,12 +44,8 @@ foreach ($projectFile in $projectFiles) Write-Host "`nBuild" Write-Host "=====" -dotnet restore -dotnet pack NotifyPropertyChangedBase\NotifyPropertyChangedBase.csproj -c Release -o $(Get-Location) - -Write-Host "`nTests Build" -Write-Host "===========" -dotnet build NotifyPropertyChangedBase.Tests\NotifyPropertyChangedBase.Tests.csproj -c Release +nuget restore +MSBuild /p:Configuration=Release /verbosity:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" Write-Host "`nArtifacts" Write-Host "=========" diff --git a/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj b/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj index 6cc24f0..e590e10 100644 --- a/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj +++ b/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj @@ -1,6 +1,6 @@  - net45;net40;netstandard1.0;portable-net451+netcore451; + net45;net40;netstandard1.0;portable-net45+win8+wpa81+wp8; NotifyPropertyChangedBase NotifyPropertyChangedBase NotifyPropertyChangedBase @@ -43,14 +43,14 @@ NotifyPropertyChangedBase.NetStandard NETSTANDARD1_0 - + NotifyPropertyChangedBase.Portable NotifyPropertyChangedBase.Portable - NET_PORTABLE_44 + NET_PORTABLE_259 .NETPortable - v4.6 - Profile44 - .NETPortable,Version=v0.0,Profile=Profile44 + v4.5 + Profile259 + .NETPortable,Version=v0.0,Profile=Profile259 $(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets From a5c69e616d7f4c60eeb63a06f9e82ed8e3b742c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Mon, 17 Jul 2017 19:56:21 +0200 Subject: [PATCH 061/118] Forgot about that.. [skip deployment] --- AppVeyor-Build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AppVeyor-Build.ps1 b/AppVeyor-Build.ps1 index 389fa4f..597a353 100644 --- a/AppVeyor-Build.ps1 +++ b/AppVeyor-Build.ps1 @@ -45,7 +45,7 @@ foreach ($projectFile in $projectFiles) Write-Host "`nBuild" Write-Host "=====" nuget restore -MSBuild /p:Configuration=Release /verbosity:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" +MSBuild /p:Configuration=Release /t:pack /verbosity:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" Write-Host "`nArtifacts" Write-Host "=========" From 810e10d159dfafc62d6997c7deaea7426d45bd59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Mon, 17 Jul 2017 20:07:09 +0200 Subject: [PATCH 062/118] ... [skip deployment] --- AppVeyor-Build.ps1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/AppVeyor-Build.ps1 b/AppVeyor-Build.ps1 index 597a353..783891b 100644 --- a/AppVeyor-Build.ps1 +++ b/AppVeyor-Build.ps1 @@ -45,12 +45,13 @@ foreach ($projectFile in $projectFiles) Write-Host "`nBuild" Write-Host "=====" nuget restore -MSBuild /p:Configuration=Release /t:pack /verbosity:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" +MSBuild "NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj" /p:Configuration=Release /t:pack /verbosity:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" +MSBuild "NotifyPropertyChangedBase.Tests/NotifyPropertyChangedBase.Tests.csproj" /p:Configuration=Release /verbosity:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" Write-Host "`nArtifacts" Write-Host "=========" -Push-AppveyorArtifact *.nupkg +Push-AppveyorArtifact "NotifyPropertyChangedBase/bin/Release/*.nupkg" $projectFolders = Get-ChildItem -Directory -Filter "NotifyPropertyChangedBase*" foreach ($projectFolder in $projectFolders) From 5ae89691e532397429fb4c3851538d91a2868d55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Wed, 19 Jul 2017 22:39:50 +0200 Subject: [PATCH 063/118] Reverting PCL changes --- AppVeyor-Build.ps1 | 15 +++++++++------ NotifyPropertyChangedBase.sln | 2 +- .../NotifyPropertyChangedBase.csproj | 13 +------------ 3 files changed, 11 insertions(+), 19 deletions(-) diff --git a/AppVeyor-Build.ps1 b/AppVeyor-Build.ps1 index 783891b..b3b98f1 100644 --- a/AppVeyor-Build.ps1 +++ b/AppVeyor-Build.ps1 @@ -42,16 +42,19 @@ foreach ($projectFile in $projectFiles) } } -Write-Host "`nBuild" -Write-Host "=====" -nuget restore -MSBuild "NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj" /p:Configuration=Release /t:pack /verbosity:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" -MSBuild "NotifyPropertyChangedBase.Tests/NotifyPropertyChangedBase.Tests.csproj" /p:Configuration=Release /verbosity:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" +Write-Host "`nLibrary Build" +Write-Host "=============" +dotnet restore +dotnet pack NotifyPropertyChangedBase\NotifyPropertyChangedBase.csproj -c Release -o $(Get-Location) + +Write-Host "`nTests Build" +Write-Host "===========" +dotnet build NotifyPropertyChangedBase.Tests\NotifyPropertyChangedBase.Tests.csproj -c Release Write-Host "`nArtifacts" Write-Host "=========" -Push-AppveyorArtifact "NotifyPropertyChangedBase/bin/Release/*.nupkg" +Push-AppveyorArtifact *.nupkg $projectFolders = Get-ChildItem -Directory -Filter "NotifyPropertyChangedBase*" foreach ($projectFolder in $projectFolders) diff --git a/NotifyPropertyChangedBase.sln b/NotifyPropertyChangedBase.sln index 7832328..8ab0daa 100644 --- a/NotifyPropertyChangedBase.sln +++ b/NotifyPropertyChangedBase.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26430.15 +VisualStudioVersion = 15.0.26430.16 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{121EBC4B-EA90-4A53-8E99-B56DA7C6646F}" ProjectSection(SolutionItems) = preProject diff --git a/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj b/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj index e590e10..a7d66c8 100644 --- a/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj +++ b/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj @@ -1,12 +1,11 @@  - net45;net40;netstandard1.0;portable-net45+win8+wpa81+wp8; + net45;net40;netstandard1.0; NotifyPropertyChangedBase NotifyPropertyChangedBase NotifyPropertyChangedBase NotifyPropertyChangedBase NotifyPropertyChangedBase provides you an easy to use base class NotifyPropertyChanged that helps you implement the INotifyPropertyChanged interface which can help you in many cases, whether are you developing WPF, Console, UWP or any other app. - Base class that helps you implement the INotifyPropertyChanged interface. Marian Dolinský Marian Dolinský © 2017 Marian Dolinský @@ -43,14 +42,4 @@ NotifyPropertyChangedBase.NetStandard NETSTANDARD1_0 - - NotifyPropertyChangedBase.Portable - NotifyPropertyChangedBase.Portable - NET_PORTABLE_259 - .NETPortable - v4.5 - Profile259 - .NETPortable,Version=v0.0,Profile=Profile259 - $(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets - From d29f58e14f5d1daf0cf08c5a6e36456d9ff6323e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Wed, 19 Jul 2017 22:46:59 +0200 Subject: [PATCH 064/118] Improved build [skip deployment] --- AppVeyor-Build.ps1 | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/AppVeyor-Build.ps1 b/AppVeyor-Build.ps1 index b3b98f1..2032b21 100644 --- a/AppVeyor-Build.ps1 +++ b/AppVeyor-Build.ps1 @@ -42,14 +42,14 @@ foreach ($projectFile in $projectFiles) } } -Write-Host "`nLibrary Build" -Write-Host "=============" +Write-Host "`nBuild" +Write-Host "=====" dotnet restore -dotnet pack NotifyPropertyChangedBase\NotifyPropertyChangedBase.csproj -c Release -o $(Get-Location) +dotnet build -c Release -l "C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" -Write-Host "`nTests Build" -Write-Host "===========" -dotnet build NotifyPropertyChangedBase.Tests\NotifyPropertyChangedBase.Tests.csproj -c Release +Write-Host "`nNuGet pack" +Write-Host "==========" +dotnet pack NotifyPropertyChangedBase\NotifyPropertyChangedBase.csproj --no-build -c Release -o $(Get-Location) Write-Host "`nArtifacts" Write-Host "=========" @@ -87,6 +87,6 @@ $targetArgs = "/testcontainer:""NotifyPropertyChangedBase.Tests.Net45\bin\Releas $filter = """+[NotifyPropertyChangedBase*]* -[NotifyPropertyChangedBase.Tests*]*""" $output = "OpenCoverResults.xml" -choco install opencover.portable codecov +choco install opencover.portable codecov --no-progress OpenCover.Console.exe -register:user -target:$target -targetargs:$targetArgs -filter:$filter -output:$output codecov -f $output From 1e4b516be9cc960a33590175604b986ac0d9d43f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Wed, 19 Jul 2017 22:50:32 +0200 Subject: [PATCH 065/118] Fixed it? --- AppVeyor-Build.ps1 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/AppVeyor-Build.ps1 b/AppVeyor-Build.ps1 index 2032b21..c9fe6d3 100644 --- a/AppVeyor-Build.ps1 +++ b/AppVeyor-Build.ps1 @@ -42,14 +42,14 @@ foreach ($projectFile in $projectFiles) } } -Write-Host "`nBuild" -Write-Host "=====" +Write-Host "`nLibrary Build" +Write-Host "=============" dotnet restore -dotnet build -c Release -l "C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" +dotnet pack NotifyPropertyChangedBase\NotifyPropertyChangedBase.csproj -c Release -o $(Get-Location) -l "C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" -Write-Host "`nNuGet pack" -Write-Host "==========" -dotnet pack NotifyPropertyChangedBase\NotifyPropertyChangedBase.csproj --no-build -c Release -o $(Get-Location) +Write-Host "`nTests Build" +Write-Host "===========" +dotnet build NotifyPropertyChangedBase.Tests\NotifyPropertyChangedBase.Tests.csproj -c Release -l "C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" Write-Host "`nArtifacts" Write-Host "=========" From 84da393e98c6646d85762bdcb15f715530c3b362 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Wed, 19 Jul 2017 23:02:05 +0200 Subject: [PATCH 066/118] That's better ^^ --- AppVeyor-Build.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AppVeyor-Build.ps1 b/AppVeyor-Build.ps1 index c9fe6d3..e7c1a68 100644 --- a/AppVeyor-Build.ps1 +++ b/AppVeyor-Build.ps1 @@ -45,11 +45,11 @@ foreach ($projectFile in $projectFiles) Write-Host "`nLibrary Build" Write-Host "=============" dotnet restore -dotnet pack NotifyPropertyChangedBase\NotifyPropertyChangedBase.csproj -c Release -o $(Get-Location) -l "C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" +dotnet pack NotifyPropertyChangedBase\NotifyPropertyChangedBase.csproj -c Release -o $(Get-Location) -l:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" Write-Host "`nTests Build" Write-Host "===========" -dotnet build NotifyPropertyChangedBase.Tests\NotifyPropertyChangedBase.Tests.csproj -c Release -l "C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" +dotnet build NotifyPropertyChangedBase.Tests\NotifyPropertyChangedBase.Tests.csproj -c Release -l:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" Write-Host "`nArtifacts" Write-Host "=========" From 010854755b481a9adce0525cb84e9a2e479baa48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Wed, 19 Jul 2017 23:06:34 +0200 Subject: [PATCH 067/118] F*cking dotnet... --- AppVeyor-Build.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AppVeyor-Build.ps1 b/AppVeyor-Build.ps1 index e7c1a68..6f90f55 100644 --- a/AppVeyor-Build.ps1 +++ b/AppVeyor-Build.ps1 @@ -45,11 +45,11 @@ foreach ($projectFile in $projectFiles) Write-Host "`nLibrary Build" Write-Host "=============" dotnet restore -dotnet pack NotifyPropertyChangedBase\NotifyPropertyChangedBase.csproj -c Release -o $(Get-Location) -l:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" +dotnet pack NotifyPropertyChangedBase\NotifyPropertyChangedBase.csproj -c Release -o $(Get-Location) Write-Host "`nTests Build" Write-Host "===========" -dotnet build NotifyPropertyChangedBase.Tests\NotifyPropertyChangedBase.Tests.csproj -c Release -l:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" +dotnet build NotifyPropertyChangedBase.Tests\NotifyPropertyChangedBase.Tests.csproj -c Release Write-Host "`nArtifacts" Write-Host "=========" From a0e7b7a359e367978ad31f8f3c56b87e4f58c1c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 20 Jul 2017 18:07:00 +0200 Subject: [PATCH 068/118] Code coverage should work now [skip deployment] --- AppVeyor-Build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AppVeyor-Build.ps1 b/AppVeyor-Build.ps1 index 6f90f55..2230126 100644 --- a/AppVeyor-Build.ps1 +++ b/AppVeyor-Build.ps1 @@ -83,7 +83,7 @@ dotnet vstest NotifyPropertyChangedBase.Tests\bin\Release\netcoreapp1.0\NotifyPr Write-Host "`nCodecov" Write-Host "=======" $target = """C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe""" -$targetArgs = "/testcontainer:""NotifyPropertyChangedBase.Tests.Net45\bin\Release\NotifyPropertyChangedBase.Tests.Net45.dll""" +$targetArgs = "/testcontainer:""NotifyPropertyChangedBase.Tests\bin\Release\net45\NotifyPropertyChangedBase.Tests.Net45.dll""" $filter = """+[NotifyPropertyChangedBase*]* -[NotifyPropertyChangedBase.Tests*]*""" $output = "OpenCoverResults.xml" From 3fa7390fd30c9839b5a85d6cefb18d40477289b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 20 Jul 2017 19:38:22 +0200 Subject: [PATCH 069/118] Or maybe now?! [skip deployment] --- AppVeyor-Build.ps1 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/AppVeyor-Build.ps1 b/AppVeyor-Build.ps1 index 2230126..9ff6e68 100644 --- a/AppVeyor-Build.ps1 +++ b/AppVeyor-Build.ps1 @@ -82,11 +82,12 @@ dotnet vstest NotifyPropertyChangedBase.Tests\bin\Release\netcoreapp1.0\NotifyPr Write-Host "`nCodecov" Write-Host "=======" -$target = """C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe""" -$targetArgs = "/testcontainer:""NotifyPropertyChangedBase.Tests\bin\Release\net45\NotifyPropertyChangedBase.Tests.Net45.dll""" +choco install opencover.portable codecov --no-progress + +$target = "dotnet.exe" +$targetArgs = "test NotifyPropertyChangedBase.Tests\NotifyPropertyChangedBase.Tests.csproj -c Release -f net45 /p:DebugType=PdbOnly" $filter = """+[NotifyPropertyChangedBase*]* -[NotifyPropertyChangedBase.Tests*]*""" $output = "OpenCoverResults.xml" -choco install opencover.portable codecov --no-progress OpenCover.Console.exe -register:user -target:$target -targetargs:$targetArgs -filter:$filter -output:$output codecov -f $output From 28a22834f20a2644ab7281ad12890b2580b1a6e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 20 Jul 2017 20:07:36 +0200 Subject: [PATCH 070/118] WHY IS .NET CORE SOO F*CKING HARD TO USE THESE DAYS [skip deployment] --- AppVeyor-Build.ps1 | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/AppVeyor-Build.ps1 b/AppVeyor-Build.ps1 index 9ff6e68..f53b4a7 100644 --- a/AppVeyor-Build.ps1 +++ b/AppVeyor-Build.ps1 @@ -47,10 +47,6 @@ Write-Host "=============" dotnet restore dotnet pack NotifyPropertyChangedBase\NotifyPropertyChangedBase.csproj -c Release -o $(Get-Location) -Write-Host "`nTests Build" -Write-Host "===========" -dotnet build NotifyPropertyChangedBase.Tests\NotifyPropertyChangedBase.Tests.csproj -c Release - Write-Host "`nArtifacts" Write-Host "=========" @@ -89,5 +85,6 @@ $targetArgs = "test NotifyPropertyChangedBase.Tests\NotifyPropertyChangedBase.Te $filter = """+[NotifyPropertyChangedBase*]* -[NotifyPropertyChangedBase.Tests*]*""" $output = "OpenCoverResults.xml" +dotnet build NotifyPropertyChangedBase\NotifyPropertyChangedBase.csproj -c Release -f net45 --no-incremental /p:DebugType=PdbOnly OpenCover.Console.exe -register:user -target:$target -targetargs:$targetArgs -filter:$filter -output:$output codecov -f $output From 3f359a3fb2ee971737007fda63c86d147e656f2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 20 Jul 2017 21:33:04 +0200 Subject: [PATCH 071/118] why am i making my life so hard? :( [skip deployment] --- AppVeyor-Build.ps1 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/AppVeyor-Build.ps1 b/AppVeyor-Build.ps1 index f53b4a7..ba70dcc 100644 --- a/AppVeyor-Build.ps1 +++ b/AppVeyor-Build.ps1 @@ -46,6 +46,11 @@ Write-Host "`nLibrary Build" Write-Host "=============" dotnet restore dotnet pack NotifyPropertyChangedBase\NotifyPropertyChangedBase.csproj -c Release -o $(Get-Location) +dotnet build NotifyPropertyChangedBase\NotifyPropertyChangedBase.csproj -c Release --no-incremental /p:DebugType=PdbOnly + +Write-Host "`nTests Build" +Write-Host "===========" +dotnet build NotifyPropertyChangedBase.Tests\NotifyPropertyChangedBase.Tests.csproj -c Release Write-Host "`nArtifacts" Write-Host "=========" @@ -81,10 +86,9 @@ Write-Host "=======" choco install opencover.portable codecov --no-progress $target = "dotnet.exe" -$targetArgs = "test NotifyPropertyChangedBase.Tests\NotifyPropertyChangedBase.Tests.csproj -c Release -f net45 /p:DebugType=PdbOnly" +$targetArgs = "test NotifyPropertyChangedBase.Tests\NotifyPropertyChangedBase.Tests.csproj -c Release -f net45 --no-build" $filter = """+[NotifyPropertyChangedBase*]* -[NotifyPropertyChangedBase.Tests*]*""" $output = "OpenCoverResults.xml" -dotnet build NotifyPropertyChangedBase\NotifyPropertyChangedBase.csproj -c Release -f net45 --no-incremental /p:DebugType=PdbOnly OpenCover.Console.exe -register:user -target:$target -targetargs:$targetArgs -filter:$filter -output:$output codecov -f $output From 412b7dab81c781de03cf5f549b178213d1c8abef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 20 Jul 2017 22:10:44 +0200 Subject: [PATCH 072/118] Added license to cs files - closes #22 [skip ci] --- NotifyPropertyChangedBase.Tests/Tests.cs | 29 ++++++++++++++++++- NotifyPropertyChangedBase.Tests/Wrapper.cs | 29 ++++++++++++++++++- NotifyPropertyChangedBase/Helpers.cs | 29 ++++++++++++++++++- .../NotifyPropertyChanged.cs | 29 ++++++++++++++++++- 4 files changed, 112 insertions(+), 4 deletions(-) diff --git a/NotifyPropertyChangedBase.Tests/Tests.cs b/NotifyPropertyChangedBase.Tests/Tests.cs index 85b3902..f85dd88 100644 --- a/NotifyPropertyChangedBase.Tests/Tests.cs +++ b/NotifyPropertyChangedBase.Tests/Tests.cs @@ -1,4 +1,31 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +#region License +// MIT License +// +// Copyright (c) 2017 Marian Dolinský +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using Microsoft.VisualStudio.TestTools.UnitTesting; using System; namespace NotifyPropertyChangedBase.Tests diff --git a/NotifyPropertyChangedBase.Tests/Wrapper.cs b/NotifyPropertyChangedBase.Tests/Wrapper.cs index a489f3a..f32b66f 100644 --- a/NotifyPropertyChangedBase.Tests/Wrapper.cs +++ b/NotifyPropertyChangedBase.Tests/Wrapper.cs @@ -1,4 +1,31 @@ -using System; +#region License +// MIT License +// +// Copyright (c) 2017 Marian Dolinský +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; using System.Runtime.CompilerServices; namespace NotifyPropertyChangedBase.Tests diff --git a/NotifyPropertyChangedBase/Helpers.cs b/NotifyPropertyChangedBase/Helpers.cs index f9a5b90..37fb74d 100644 --- a/NotifyPropertyChangedBase/Helpers.cs +++ b/NotifyPropertyChangedBase/Helpers.cs @@ -1,4 +1,31 @@ -using System; +#region License +// MIT License +// +// Copyright (c) 2017 Marian Dolinský +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; #if!NET_40 using System.Reflection; #endif diff --git a/NotifyPropertyChangedBase/NotifyPropertyChanged.cs b/NotifyPropertyChangedBase/NotifyPropertyChanged.cs index 74759f4..4a734d1 100644 --- a/NotifyPropertyChangedBase/NotifyPropertyChanged.cs +++ b/NotifyPropertyChangedBase/NotifyPropertyChanged.cs @@ -1,4 +1,31 @@ -using System; +#region License +// MIT License +// +// Copyright (c) 2017 Marian Dolinský +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; using System.Collections.Generic; using System.ComponentModel; #if !NET_40 From 9598532c45f6494b76d62d160b6119d9a1441b00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Sun, 23 Jul 2017 23:17:26 +0200 Subject: [PATCH 073/118] Made the OnPropertyChanged method virtual - closes #24 --- NotifyPropertyChangedBase/NotifyPropertyChanged.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NotifyPropertyChangedBase/NotifyPropertyChanged.cs b/NotifyPropertyChangedBase/NotifyPropertyChanged.cs index 4a734d1..287fa5c 100644 --- a/NotifyPropertyChangedBase/NotifyPropertyChanged.cs +++ b/NotifyPropertyChangedBase/NotifyPropertyChanged.cs @@ -277,9 +277,9 @@ private void SetValue(object value, string propertyName, bool forceSetValue) /// Name of the changed property. /// is null or white space. #if NET_40 - protected void OnPropertyChanged(string propertyName) + protected virtual void OnPropertyChanged(string propertyName) #else - protected void OnPropertyChanged([CallerMemberName]string propertyName = null) + protected virtual void OnPropertyChanged([CallerMemberName]string propertyName = null) #endif { Helpers.ValidateStringNotNullOrWhiteSpace(propertyName, nameof(propertyName)); From 019b288d52b7d312dc743710b34dd9bc19015bae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Mon, 24 Jul 2017 10:17:42 +0200 Subject: [PATCH 074/118] Updated description - closes #23 --- NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj b/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj index a7d66c8..065ac78 100644 --- a/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj +++ b/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj @@ -5,7 +5,7 @@ NotifyPropertyChangedBase NotifyPropertyChangedBase NotifyPropertyChangedBase - NotifyPropertyChangedBase provides you an easy to use base class NotifyPropertyChanged that helps you implement the INotifyPropertyChanged interface which can help you in many cases, whether are you developing WPF, Console, UWP or any other app. + Provides DependencyObject-like implementation of INotifyPropertyChanged. Marian Dolinský Marian Dolinský © 2017 Marian Dolinský From f6b5a3e30b97613e080d9c6541acc84c1f429719 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Mon, 24 Jul 2017 21:37:35 +0200 Subject: [PATCH 075/118] Started working on new readme --- .../NotifyPropertyChangedBase.csproj | 2 +- README.md | 68 +++++++++++++++++-- 2 files changed, 64 insertions(+), 6 deletions(-) diff --git a/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj b/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj index 065ac78..5c97b37 100644 --- a/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj +++ b/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj @@ -5,7 +5,7 @@ NotifyPropertyChangedBase NotifyPropertyChangedBase NotifyPropertyChangedBase - Provides DependencyObject-like implementation of INotifyPropertyChanged. + Provides a simple yet powerful implementation of INotifyPropertyChanged. Marian Dolinský Marian Dolinský © 2017 Marian Dolinský diff --git a/README.md b/README.md index 438a990..5d9d986 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,75 @@ # NotifyPropertyChangedBase [![NuGet](https://img.shields.io/nuget/v/NotifyPropertyChangedBase.svg)](https://www.nuget.org/packages/NotifyPropertyChangedBase/) [![Build status](https://ci.appveyor.com/api/projects/status/jc9gcr4gldjr8nq6/branch/master?svg=true)](https://ci.appveyor.com/project/bramborman/notifypropertychangedbase/branch/master) -[![codecov](https://codecov.io/gh/bramborman/NotifyPropertyChangedBase/branch/master/graph/badge.svg)](https://codecov.io/gh/bramborman/NotifyPropertyChangedBase) +[![Code coverage](https://codecov.io/gh/bramborman/NotifyPropertyChangedBase/branch/master/graph/badge.svg)](https://codecov.io/gh/bramborman/NotifyPropertyChangedBase) [![Issues](https://img.shields.io/github/issues/bramborman/NotifyPropertyChangedBase.svg)](https://github.com/bramborman/NotifyPropertyChangedBase/issues) [![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/bramborman/NotifyPropertyChangedBase/blob/master/LICENSE.md) -NotifyPropertyChangedBase provides you an easy to use base class `NotifyPropertyChanged` that helps you implement the `INotifyPropertyChanged` interface which can help you in many cases, whether are you developing WPF, Console, UWP or any other app. +NotifyPropertyChangedBase provides a simple yet powerful base class `NotifyPropertyChanged` that implements the `INotifyPropertyChanged` interface. Whether you're writing UWP, Xamarin, WPF or any other app, it may help you work with data. ### Pre-release [![MyGet](https://img.shields.io/myget/bramborman/vpre/NotifyPropertyChangedBase.svg)][MyGet] [![Build status](https://ci.appveyor.com/api/projects/status/jc9gcr4gldjr8nq6/branch/dev?svg=true)](https://ci.appveyor.com/project/bramborman/notifypropertychangedbase/branch/dev) -[![codecov](https://codecov.io/gh/bramborman/NotifyPropertyChangedBase/branch/dev/graph/badge.svg)](https://codecov.io/gh/bramborman/NotifyPropertyChangedBase/branch/dev) +[![Code coverage](https://codecov.io/gh/bramborman/NotifyPropertyChangedBase/branch/dev/graph/badge.svg)](https://codecov.io/gh/bramborman/NotifyPropertyChangedBase/branch/dev) -If you want to get updates more frequently and you don't mind about the possibility of experiencing some bugs with this library sometimes, you can download the pre-release version of NotifyPropertyChangedBase from MyGet.org right [**here**][MyGet]. +If you want to get updates more frequently and you don't mind the possibility of bugs, you can download the pre-release version of NotifyPropertyChangedBase from MyGet.org right [**here**][MyGet]. -[MyGet]: https://www.myget.org/feed/bramborman/package/nuget/NotifyPropertyChangedBase \ No newline at end of file +[MyGet]: https://www.myget.org/feed/bramborman/package/nuget/NotifyPropertyChangedBase + +## How-to +NotifyPropertyChangedBase library consists of one namespace `NotifyPropertyChangedBase` which contains one class - `NotifyPropertyChanged`. This class implements the `INotifyPropertyChanged` interface and has some additional methods to help you use it. It's usage is similar to the usage of `DependencyObject` however it does not inherit from it nor it can be used only on UI thread - you can access it from any thread you want. + +Here is a simple class that inherits from `NotifyPropertyChanged` class. +To be able to use any property, you have to register it using the `RegisterProperty` method. It has three required parameters: + - name of the property (using it you'll be accessing its value and doing all the work with the property) + - type of the property + - default value of the property + - (optional) property changed callback - a method that will be invoked when given property changes providing you info about the previous value of the property and it's new - current value + +> Please note that unlike `DependencyProperty.Register` the `RegisterProperty` method here does not return anything and you don't have to store anything. You're accessing the property only using it's name. + + using NotifyPropertyChangedBase; + + class Foo : NotifyPropertyChanged + { + public int Bar + { + get { return (int)GetValue(); } + set { SetValue(value); } + } + public string Greeting + { + get { return (string)GetValue(); } + set { SetValue(value); } + } + + public Foo() + { + RegisterProperty(nameof(Bar), typeof(int), 0); + RegisterProperty(nameof(Greeting), typeof(string), null, GreetingPropertyChanged); + } + + private void GreetingPropertyChanged(NotifyPropertyChanged sender, PropertyChangedCallbackArgs e) + { + Console.WriteLine($"Value of Greeting changed from '{e.OldValue}' to '{e.NewValue}'"); + } + } + +#### Working with properties +In the first example we've been using the simpliest way of working with properties - `GetValue` and `SetValue` methods that works without/with one parameter and you don't have to specify the name of the property you're working with. That's because these methods, similarly to the `ForceSetValue` method that we'll be talking about later uses [`CallerMemberNameAttribute`](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.callermembernameattribute) that does it for you. But you can also specify the name of the property you want to work with manually, for instance, `GetValue("Bar")` will return the actual value of the property `Bar`. + +`GetValue` and `SetValue` methods does simply what their name implies - get or set the value of a property with the given name but there's another similar method - `ForceSetValue`. The difference between `SetValue` and `ForceSetValue` is that the latter always sets the new value to a property however `SetValue` checks whether the old value and the new one are the same using the `Equals` (you may want to [override it](https://docs.microsoft.com/en-us/dotnet/api/system.object.equals) to achieve the desired result on this check) and assigns the new value and tries to invoke the `PropertyChanged` event and `PropertyChangedCallback` only if the two values are not equal. + +#### Structure of the `NotifyPropertyChanged` class +All the members of this class are `protected` - only derived classes can use them. + + protected bool IsPropertyChangedCallbackInvokingEnabled { get; set; } + protected bool IsPropertyChangedEventInvokingEnabled { get; set; } + protected void RegisterProperty(string name, Type type, object defaultValue + protected void RegisterProperty(string name, Type type, object defaultValue, PropertyChangedCallbackHandler propertyChangedCallback) + protected void RegisterPropertyChangedCallback(string propertyName, PropertyChangedCallbackHandler propertyChangedCallback) + protected void UnregisterPropertyChangedCallback(string propertyName, PropertyChangedCallbackHandler propertyChangedCallback) + protected object GetValue([CallerMemberName]string propertyName = null) + protected void ForceSetValue(object value, [CallerMemberName]string propertyName = null) + protected void SetValue(object value, [CallerMemberName]string propertyName = null) + protected virtual void OnPropertyChanged([CallerMemberName]string propertyName = null) From f8da2b7712652456387abe2a2105db5cef2f92cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Mon, 24 Jul 2017 21:51:14 +0200 Subject: [PATCH 076/118] Improvement lol [skip ci] --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5d9d986..3c8586b 100644 --- a/README.md +++ b/README.md @@ -55,12 +55,12 @@ To be able to use any property, you have to register it using the `RegisterPrope } } -#### Working with properties +### Working with properties In the first example we've been using the simpliest way of working with properties - `GetValue` and `SetValue` methods that works without/with one parameter and you don't have to specify the name of the property you're working with. That's because these methods, similarly to the `ForceSetValue` method that we'll be talking about later uses [`CallerMemberNameAttribute`](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.callermembernameattribute) that does it for you. But you can also specify the name of the property you want to work with manually, for instance, `GetValue("Bar")` will return the actual value of the property `Bar`. `GetValue` and `SetValue` methods does simply what their name implies - get or set the value of a property with the given name but there's another similar method - `ForceSetValue`. The difference between `SetValue` and `ForceSetValue` is that the latter always sets the new value to a property however `SetValue` checks whether the old value and the new one are the same using the `Equals` (you may want to [override it](https://docs.microsoft.com/en-us/dotnet/api/system.object.equals) to achieve the desired result on this check) and assigns the new value and tries to invoke the `PropertyChanged` event and `PropertyChangedCallback` only if the two values are not equal. -#### Structure of the `NotifyPropertyChanged` class +### Structure of the `NotifyPropertyChanged` class All the members of this class are `protected` - only derived classes can use them. protected bool IsPropertyChangedCallbackInvokingEnabled { get; set; } From fa9d12dd3926d89651f6113b92825408d560fd0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Tue, 25 Jul 2017 20:19:55 +0200 Subject: [PATCH 077/118] Formatting [skip ci] --- NotifyPropertyChangedBase.Tests/Tests.cs | 4 +--- NotifyPropertyChangedBase.Tests/Wrapper.cs | 4 +--- NotifyPropertyChangedBase/Helpers.cs | 6 ++---- NotifyPropertyChangedBase/NotifyPropertyChanged.cs | 4 +--- 4 files changed, 5 insertions(+), 13 deletions(-) diff --git a/NotifyPropertyChangedBase.Tests/Tests.cs b/NotifyPropertyChangedBase.Tests/Tests.cs index f85dd88..f0eeab1 100644 --- a/NotifyPropertyChangedBase.Tests/Tests.cs +++ b/NotifyPropertyChangedBase.Tests/Tests.cs @@ -1,5 +1,4 @@ -#region License -// MIT License +// MIT License // // Copyright (c) 2017 Marian Dolinský // @@ -23,7 +22,6 @@ // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // OTHER DEALINGS IN THE SOFTWARE. -#endregion using Microsoft.VisualStudio.TestTools.UnitTesting; using System; diff --git a/NotifyPropertyChangedBase.Tests/Wrapper.cs b/NotifyPropertyChangedBase.Tests/Wrapper.cs index f32b66f..6e20429 100644 --- a/NotifyPropertyChangedBase.Tests/Wrapper.cs +++ b/NotifyPropertyChangedBase.Tests/Wrapper.cs @@ -1,5 +1,4 @@ -#region License -// MIT License +// MIT License // // Copyright (c) 2017 Marian Dolinský // @@ -23,7 +22,6 @@ // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // OTHER DEALINGS IN THE SOFTWARE. -#endregion using System; using System.Runtime.CompilerServices; diff --git a/NotifyPropertyChangedBase/Helpers.cs b/NotifyPropertyChangedBase/Helpers.cs index 37fb74d..5c4ea59 100644 --- a/NotifyPropertyChangedBase/Helpers.cs +++ b/NotifyPropertyChangedBase/Helpers.cs @@ -1,5 +1,4 @@ -#region License -// MIT License +// MIT License // // Copyright (c) 2017 Marian Dolinský // @@ -23,10 +22,9 @@ // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // OTHER DEALINGS IN THE SOFTWARE. -#endregion using System; -#if!NET_40 +#if !NET_40 using System.Reflection; #endif diff --git a/NotifyPropertyChangedBase/NotifyPropertyChanged.cs b/NotifyPropertyChangedBase/NotifyPropertyChanged.cs index 287fa5c..a4cacc7 100644 --- a/NotifyPropertyChangedBase/NotifyPropertyChanged.cs +++ b/NotifyPropertyChangedBase/NotifyPropertyChanged.cs @@ -1,5 +1,4 @@ -#region License -// MIT License +// MIT License // // Copyright (c) 2017 Marian Dolinský // @@ -23,7 +22,6 @@ // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // OTHER DEALINGS IN THE SOFTWARE. -#endregion using System; using System.Collections.Generic; From 358785d57d51b1387e81c8dd8c6d6ec904a1fc83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Tue, 25 Jul 2017 21:49:40 +0200 Subject: [PATCH 078/118] Probably finished GetSetValueTests --- NotifyPropertyChangedBase.Tests/Tests.cs | 102 ++++++++++++++++++++--- 1 file changed, 91 insertions(+), 11 deletions(-) diff --git a/NotifyPropertyChangedBase.Tests/Tests.cs b/NotifyPropertyChangedBase.Tests/Tests.cs index f0eeab1..14d1e9b 100644 --- a/NotifyPropertyChangedBase.Tests/Tests.cs +++ b/NotifyPropertyChangedBase.Tests/Tests.cs @@ -31,31 +31,53 @@ namespace NotifyPropertyChangedBase.Tests [TestClass] public sealed class Tests { + //U = uint + //L = long + //UL = ulong + //F = float + //M = decimal + //D = double + + private readonly string[] invalidPropertyNames = new string[] { null, "", " ", "\n\t\v\r" }; + private readonly object[] invalidInt32Values = new object[] + { + null, + true, + 'x', + (byte)0, + (sbyte)0, + 0U, + 0L, + 0UL, + 0F, + 0M, + 0D, + new Test() + }; + [TestMethod] public void RegisterPropertyTests() { Wrapper w = new Wrapper(); - Assert.ThrowsException(() => w.RegisterProperty(null, typeof(int), 0)); - Assert.ThrowsException(() => w.RegisterProperty("", typeof(int), 0)); - Assert.ThrowsException(() => w.RegisterProperty(" ", typeof(int), 0)); - Assert.ThrowsException(() => w.RegisterProperty("\n\t\v\r", typeof(int), 0)); + // Invalid property name + TestInvalidPropertyNames(invalidPropertyName => w.RegisterProperty(invalidPropertyName, typeof(int), 0)); + // Invalid type argument Assert.ThrowsException(() => w.RegisterProperty("P", null, 0)); - Assert.ThrowsException(() => w.RegisterProperty("P", typeof(int), null)); - Assert.ThrowsException(() => w.RegisterProperty("P", typeof(int), true)); - Assert.ThrowsException(() => w.RegisterProperty("P", typeof(int), long.MaxValue)); - Assert.ThrowsException(() => w.RegisterProperty("P", typeof(int), 'x')); - Assert.ThrowsException(() => w.RegisterProperty("P", typeof(int), "")); - Assert.ThrowsException(() => w.RegisterProperty("P", typeof(int), new Test())); + // Invalid default value + TestInvalidInt32Values(invalidInt32Value => w.RegisterProperty("P", typeof(int), invalidInt32Value)); Assert.ThrowsException(() => w.RegisterProperty("P", typeof(uint), -1)); + // Valid arguments const string PROP_1 = "1"; w.RegisterProperty(PROP_1, typeof(int), 0); + // Registering another property with the same name Assert.ThrowsException(() => w.RegisterProperty(PROP_1, typeof(int), 0)); + // Valid default values w.RegisterProperty("ITest", typeof(ITest), null); w.RegisterProperty("ITest2", typeof(ITest), new Test()); w.RegisterProperty("TestBase", typeof(TestBase), null); @@ -65,9 +87,67 @@ public void RegisterPropertyTests() } [TestMethod] - public void GetValueTests() + public void GetSetValueTests() + { + Wrapper w = new Wrapper(); + + // Invalid property name + TestInvalidPropertyNames(invalidPropertyName => w.GetValue(invalidPropertyName)); + + { + const string PROP_1 = "1"; + + int prop1Value = 0; + w.RegisterProperty(PROP_1, typeof(int), prop1Value); + Assert.AreEqual(prop1Value, w.GetValue(PROP_1)); + + prop1Value++; + Assert.AreNotEqual(prop1Value, w.GetValue(PROP_1)); + + w.SetValue(prop1Value, PROP_1); + Assert.AreEqual(prop1Value, w.GetValue(PROP_1)); + + prop1Value++; + w.ForceSetValue(prop1Value, PROP_1); + Assert.AreEqual(prop1Value, w.GetValue(PROP_1)); + + // Invalid value + TestInvalidInt32Values(invalidInt32Value => w.SetValue(invalidInt32Value, PROP_1)); + } + + { + const string PROP_2 = "2"; + + Test prop2Value = new Test(); + w.RegisterProperty(PROP_2, typeof(Test), prop2Value); + Assert.AreEqual(prop2Value, w.GetValue(PROP_2)); + + prop2Value = new Test(); + Assert.AreNotEqual(prop2Value, w.GetValue(PROP_2)); + + w.SetValue(prop2Value, PROP_2); + Assert.AreEqual(prop2Value, w.GetValue(PROP_2)); + + prop2Value = new Test(); + w.ForceSetValue(prop2Value, PROP_2); + Assert.AreEqual(prop2Value, w.GetValue(PROP_2)); + } + } + + private void TestInvalidPropertyNames(Action action) { + foreach (string invalidPropertyName in invalidPropertyNames) + { + Assert.ThrowsException(() => action(invalidPropertyName)); + } + } + private void TestInvalidInt32Values(Action action) + { + foreach (object invalidInt32Value in invalidInt32Values) + { + Assert.ThrowsException(() => action(invalidInt32Value)); + } } private interface ITest From 0d72b2b2649e3d245b5d92d81c07e2bc991707f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 3 Aug 2017 18:45:46 +0200 Subject: [PATCH 079/118] Added ForceSetValue test [skip deployment] --- NotifyPropertyChangedBase.Tests/Tests.cs | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/NotifyPropertyChangedBase.Tests/Tests.cs b/NotifyPropertyChangedBase.Tests/Tests.cs index 14d1e9b..38ab59e 100644 --- a/NotifyPropertyChangedBase.Tests/Tests.cs +++ b/NotifyPropertyChangedBase.Tests/Tests.cs @@ -39,21 +39,7 @@ public sealed class Tests //D = double private readonly string[] invalidPropertyNames = new string[] { null, "", " ", "\n\t\v\r" }; - private readonly object[] invalidInt32Values = new object[] - { - null, - true, - 'x', - (byte)0, - (sbyte)0, - 0U, - 0L, - 0UL, - 0F, - 0M, - 0D, - new Test() - }; + private readonly object[] invalidInt32Values = new object[] { null, true, 'x', (byte)0, (sbyte)0, 0U, 0L, 0UL, 0F, 0M, 0D, new Test() }; [TestMethod] public void RegisterPropertyTests() @@ -87,7 +73,7 @@ public void RegisterPropertyTests() } [TestMethod] - public void GetSetValueTests() + public void GetSetForceSetValueTests() { Wrapper w = new Wrapper(); @@ -113,6 +99,7 @@ public void GetSetValueTests() // Invalid value TestInvalidInt32Values(invalidInt32Value => w.SetValue(invalidInt32Value, PROP_1)); + TestInvalidInt32Values(invalidInt32Value => w.ForceSetValue(invalidInt32Value, PROP_1)); } { From 3843a33b12d9e87206e5a5fed0f1453a2f1e61ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Mon, 4 Sep 2017 19:52:32 +0200 Subject: [PATCH 080/118] Improved Unit tests --- NotifyPropertyChangedBase.Tests/Tests.cs | 31 ++++++++++-------------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/NotifyPropertyChangedBase.Tests/Tests.cs b/NotifyPropertyChangedBase.Tests/Tests.cs index 38ab59e..0458c5c 100644 --- a/NotifyPropertyChangedBase.Tests/Tests.cs +++ b/NotifyPropertyChangedBase.Tests/Tests.cs @@ -25,6 +25,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System; +using System.Collections.Generic; namespace NotifyPropertyChangedBase.Tests { @@ -38,8 +39,8 @@ public sealed class Tests //M = decimal //D = double - private readonly string[] invalidPropertyNames = new string[] { null, "", " ", "\n\t\v\r" }; - private readonly object[] invalidInt32Values = new object[] { null, true, 'x', (byte)0, (sbyte)0, 0U, 0L, 0UL, 0F, 0M, 0D, new Test() }; + private readonly string[] invalidPropertyNames = new string[] { null, "", "\n\t \v\r" }; + private readonly object[] invalidInt32Values = new object[] { null, true, 'x', "", (byte)0, (sbyte)0, 0U, 0L, 0UL, 0F, 0M, 0D, new Test() }; [TestMethod] public void RegisterPropertyTests() @@ -47,13 +48,13 @@ public void RegisterPropertyTests() Wrapper w = new Wrapper(); // Invalid property name - TestInvalidPropertyNames(invalidPropertyName => w.RegisterProperty(invalidPropertyName, typeof(int), 0)); + AllThrows(invalidPropertyNames, invalidPropertyName => w.RegisterProperty(invalidPropertyName, typeof(int), 0)); // Invalid type argument Assert.ThrowsException(() => w.RegisterProperty("P", null, 0)); // Invalid default value - TestInvalidInt32Values(invalidInt32Value => w.RegisterProperty("P", typeof(int), invalidInt32Value)); + AllThrows(invalidInt32Values, invalidInt32Value => w.RegisterProperty("P", typeof(int), invalidInt32Value)); Assert.ThrowsException(() => w.RegisterProperty("P", typeof(uint), -1)); // Valid arguments @@ -64,6 +65,8 @@ public void RegisterPropertyTests() Assert.ThrowsException(() => w.RegisterProperty(PROP_1, typeof(int), 0)); // Valid default values + w.RegisterProperty("Nullable1", typeof(bool?), null); + w.RegisterProperty("Nullable2", typeof(bool?), true); w.RegisterProperty("ITest", typeof(ITest), null); w.RegisterProperty("ITest2", typeof(ITest), new Test()); w.RegisterProperty("TestBase", typeof(TestBase), null); @@ -78,7 +81,7 @@ public void GetSetForceSetValueTests() Wrapper w = new Wrapper(); // Invalid property name - TestInvalidPropertyNames(invalidPropertyName => w.GetValue(invalidPropertyName)); + AllThrows(invalidPropertyNames, invalidPropertyName => w.GetValue(invalidPropertyName)); { const string PROP_1 = "1"; @@ -98,8 +101,8 @@ public void GetSetForceSetValueTests() Assert.AreEqual(prop1Value, w.GetValue(PROP_1)); // Invalid value - TestInvalidInt32Values(invalidInt32Value => w.SetValue(invalidInt32Value, PROP_1)); - TestInvalidInt32Values(invalidInt32Value => w.ForceSetValue(invalidInt32Value, PROP_1)); + AllThrows(invalidInt32Values, invalidInt32Value => w.SetValue(invalidInt32Value, PROP_1)); + AllThrows(invalidInt32Values, invalidInt32Value => w.ForceSetValue(invalidInt32Value, PROP_1)); } { @@ -121,19 +124,11 @@ public void GetSetForceSetValueTests() } } - private void TestInvalidPropertyNames(Action action) + private void AllThrows(IEnumerable collection, Action action) where TException : Exception { - foreach (string invalidPropertyName in invalidPropertyNames) + foreach (TObject item in collection) { - Assert.ThrowsException(() => action(invalidPropertyName)); - } - } - - private void TestInvalidInt32Values(Action action) - { - foreach (object invalidInt32Value in invalidInt32Values) - { - Assert.ThrowsException(() => action(invalidInt32Value)); + Assert.ThrowsException(() => action(item)); } } From 55a123d8b0335f564745487f4bd3f562121701a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Tue, 5 Sep 2017 15:48:40 +0200 Subject: [PATCH 081/118] Testing AppVeyor's built in version patching - closes #26 if works --- AppVeyor-Build.ps1 | 38 -------------------------------------- appveyor.yml | 6 +++++- 2 files changed, 5 insertions(+), 39 deletions(-) diff --git a/AppVeyor-Build.ps1 b/AppVeyor-Build.ps1 index ba70dcc..539797f 100644 --- a/AppVeyor-Build.ps1 +++ b/AppVeyor-Build.ps1 @@ -4,44 +4,6 @@ Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildScripts/master/Scripts/Set-PureBuildVersion.ps1" .\Set-PureBuildVersion.ps1 -Write-Host "`nVersions patching" -Write-Host "=================" -Install-Module -Name powershell-yaml -Force - -if($LastExitCode -ne 0) -{ - $host.SetShouldExit($LastExitCode) -} - -$yaml = Get-Content .\appveyor.yml -Raw -$appveyorConfig = ConvertFrom-Yaml $yaml -$buildVersion = $appveyorConfig.version.Replace('-', '.').Replace("{branch}", $null).Replace("{build}", $env:APPVEYOR_BUILD_NUMBER) -$projectFiles = Get-ChildItem -Include "*.csproj" -Recurse - -foreach ($projectFile in $projectFiles) -{ - $xml = [xml](Get-Content $projectFile.FullName) - - $propertyGroup = $xml | Select-Xml -XPath "/Project/PropertyGroup[Version='1.0.0']" - $propertyGroup = $propertyGroup.Node - - $propertyGroup.Version = $buildVersion - $propertyGroup.FileVersion = $buildVersion - $propertyGroup.AssemblyVersion = $buildVersion - - if (!($projectFile.Name.Contains("Tests"))) - { - $propertyGroup.PackageVersion = $env:APPVEYOR_BUILD_VERSION - } - - $xml.Save($projectFile.FullName) - - if($LastExitCode -ne 0) - { - $host.SetShouldExit($LastExitCode) - } -} - Write-Host "`nLibrary Build" Write-Host "=============" dotnet restore diff --git a/appveyor.yml b/appveyor.yml index feae2f4..fcd5f4f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,7 +5,6 @@ branches: only: - master - dev - - a-single-csproj skip_tags: true skip_commits: files: @@ -14,6 +13,11 @@ skip_commits: - LICENSE.md - README.md image: Visual Studio 2017 +dotnet_csproj: + patch: true + file: '**\*.csproj' + version: '{version}' + package_version: '{version}' build_script: - ps: '& .\AppVeyor-Build.ps1' deploy: From 768ad2b772543cb8f039de0ebc735ab09e90674e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Tue, 5 Sep 2017 15:55:18 +0200 Subject: [PATCH 082/118] Didn't work that well... #26 [skip deployment] --- .../NotifyPropertyChangedBase.Tests.csproj | 2 -- NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj | 2 -- 2 files changed, 4 deletions(-) diff --git a/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedBase.Tests.csproj b/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedBase.Tests.csproj index bc66cae..ab3ed2f 100644 --- a/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedBase.Tests.csproj +++ b/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedBase.Tests.csproj @@ -9,8 +9,6 @@ Marian Dolinský © 2017 Marian Dolinský 1.0.0 - 1.0.0.0 - 1.0.0.0 https://github.com/bramborman/NotifyPropertyChangedBase git en-US diff --git a/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj b/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj index 5c97b37..c08d326 100644 --- a/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj +++ b/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj @@ -10,9 +10,7 @@ Marian Dolinský © 2017 Marian Dolinský 1.0.0 - 1.0.0.0 1.0.0 - 1.0.0.0 MVVM Binding Bindings Helper Helpers https://github.com/bramborman/NotifyPropertyChangedBase/blob/master/LICENSE.md https://github.com/bramborman/NotifyPropertyChangedBase From a79787eb4eaa52682c9f5174aefb8bcaec770461 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Tue, 5 Sep 2017 16:28:47 +0200 Subject: [PATCH 083/118] Reverting changes made because of #26 [skip deployment] --- AppVeyor-Build.ps1 | 39 +++++++++++++++++++ .../NotifyPropertyChangedBase.Tests.csproj | 2 + .../NotifyPropertyChangedBase.csproj | 2 + appveyor.yml | 5 --- 4 files changed, 43 insertions(+), 5 deletions(-) diff --git a/AppVeyor-Build.ps1 b/AppVeyor-Build.ps1 index 539797f..9c54b9f 100644 --- a/AppVeyor-Build.ps1 +++ b/AppVeyor-Build.ps1 @@ -4,6 +4,45 @@ Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildScripts/master/Scripts/Set-PureBuildVersion.ps1" .\Set-PureBuildVersion.ps1 +Write-Host "`nVersions patching" +Write-Host "=================" +Install-Module -Name powershell-yaml -Force + +if($LastExitCode -ne 0) +{ + $host.SetShouldExit($LastExitCode) +} + +$yaml = Get-Content .\appveyor.yml -Raw +$appveyorConfig = ConvertFrom-Yaml $yaml +$buildVersion = $appveyorConfig.version.Replace('-', '.').Replace("{branch}", $null).Replace("{build}", $env:APPVEYOR_BUILD_NUMBER) +$projectFiles = Get-ChildItem -Include "*.csproj" -Recurse + +foreach ($projectFile in $projectFiles) +{ + $xml = [xml](Get-Content $projectFile.FullName) + + $propertyGroup = $xml | Select-Xml -XPath "/Project/PropertyGroup[Version='1.0.0']" + $propertyGroup = $propertyGroup.Node + + $propertyGroup.Version = $buildVersion + $propertyGroup.FileVersion = $buildVersion + $propertyGroup.AssemblyVersion = $buildVersion + + if (!($projectFile.Name.Contains("Tests"))) + { + $propertyGroup.PackageVersion = $env:APPVEYOR_BUILD_VERSION + } + + $xml.Save($projectFile.FullName) + + if($LastExitCode -ne 0) + { + $host.SetShouldExit($LastExitCode) + } +} + + Write-Host "`nLibrary Build" Write-Host "=============" dotnet restore diff --git a/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedBase.Tests.csproj b/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedBase.Tests.csproj index ab3ed2f..bc66cae 100644 --- a/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedBase.Tests.csproj +++ b/NotifyPropertyChangedBase.Tests/NotifyPropertyChangedBase.Tests.csproj @@ -9,6 +9,8 @@ Marian Dolinský © 2017 Marian Dolinský 1.0.0 + 1.0.0.0 + 1.0.0.0 https://github.com/bramborman/NotifyPropertyChangedBase git en-US diff --git a/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj b/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj index c08d326..5c97b37 100644 --- a/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj +++ b/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj @@ -10,7 +10,9 @@ Marian Dolinský © 2017 Marian Dolinský 1.0.0 + 1.0.0.0 1.0.0 + 1.0.0.0 MVVM Binding Bindings Helper Helpers https://github.com/bramborman/NotifyPropertyChangedBase/blob/master/LICENSE.md https://github.com/bramborman/NotifyPropertyChangedBase diff --git a/appveyor.yml b/appveyor.yml index fcd5f4f..ecf1c90 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -13,11 +13,6 @@ skip_commits: - LICENSE.md - README.md image: Visual Studio 2017 -dotnet_csproj: - patch: true - file: '**\*.csproj' - version: '{version}' - package_version: '{version}' build_script: - ps: '& .\AppVeyor-Build.ps1' deploy: From a0649ac011e06e2ed4c69506716e796fd0dc8246 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Tue, 5 Sep 2017 18:29:28 +0200 Subject: [PATCH 084/118] Kinda refactored Unit tests or what --- NotifyPropertyChangedBase.Tests/Tests.cs | 101 ++++++++++++----------- 1 file changed, 53 insertions(+), 48 deletions(-) diff --git a/NotifyPropertyChangedBase.Tests/Tests.cs b/NotifyPropertyChangedBase.Tests/Tests.cs index 0458c5c..3eb87ba 100644 --- a/NotifyPropertyChangedBase.Tests/Tests.cs +++ b/NotifyPropertyChangedBase.Tests/Tests.cs @@ -32,16 +32,17 @@ namespace NotifyPropertyChangedBase.Tests [TestClass] public sealed class Tests { - //U = uint - //L = long - //UL = ulong - //F = float - //M = decimal - //D = double - + // U = uint + // L = long + // UL = ulong + // F = float + // M = decimal + // D = double private readonly string[] invalidPropertyNames = new string[] { null, "", "\n\t \v\r" }; private readonly object[] invalidInt32Values = new object[] { null, true, 'x', "", (byte)0, (sbyte)0, 0U, 0L, 0UL, 0F, 0M, 0D, new Test() }; - + private readonly object[] invalidNullableInt32Values = new object[] { true, 'x', "", (byte)0, (sbyte)0, 0U, 0L, 0UL, 0F, 0M, 0D, new Test() }; + private readonly object[] invalidTestValues = new object[] { true, 'x', "", (byte)0, (sbyte)0, 0, 0U, 0L, 0UL, 0F, 0M, 0D }; + [TestMethod] public void RegisterPropertyTests() { @@ -55,24 +56,27 @@ public void RegisterPropertyTests() // Invalid default value AllThrows(invalidInt32Values, invalidInt32Value => w.RegisterProperty("P", typeof(int), invalidInt32Value)); + AllThrows(invalidNullableInt32Values, invalidNullableInt32Value => w.RegisterProperty("P", typeof(int?), invalidNullableInt32Value)); Assert.ThrowsException(() => w.RegisterProperty("P", typeof(uint), -1)); + AllThrows(invalidTestValues, invalidTestValue => w.RegisterProperty("P", typeof(ITest), invalidTestValue)); + AllThrows(invalidTestValues, invalidTestValue => w.RegisterProperty("P", typeof(TestBase), invalidTestValue)); + AllThrows(invalidTestValues, invalidTestValue => w.RegisterProperty("P", typeof(Test), invalidTestValue)); - // Valid arguments - const string PROP_1 = "1"; - w.RegisterProperty(PROP_1, typeof(int), 0); - - // Registering another property with the same name - Assert.ThrowsException(() => w.RegisterProperty(PROP_1, typeof(int), 0)); + const string PROP_INT32 = "Int32"; // Valid default values - w.RegisterProperty("Nullable1", typeof(bool?), null); - w.RegisterProperty("Nullable2", typeof(bool?), true); + w.RegisterProperty(PROP_INT32, typeof(int), 0); + w.RegisterProperty("Nullable1", typeof(int?), null); + w.RegisterProperty("Nullable2", typeof(int?), 0); w.RegisterProperty("ITest", typeof(ITest), null); w.RegisterProperty("ITest2", typeof(ITest), new Test()); w.RegisterProperty("TestBase", typeof(TestBase), null); w.RegisterProperty("TestBase2", typeof(TestBase), new Test()); w.RegisterProperty("Test", typeof(Test), null); w.RegisterProperty("Test2", typeof(Test), new Test()); + + // Registering another property with the same name + Assert.ThrowsException(() => w.RegisterProperty(PROP_INT32, typeof(int), 0)); } [TestMethod] @@ -82,45 +86,46 @@ public void GetSetForceSetValueTests() // Invalid property name AllThrows(invalidPropertyNames, invalidPropertyName => w.GetValue(invalidPropertyName)); - + AllThrows(invalidPropertyNames, invalidPropertyName => w.SetValue(invalidPropertyName)); + AllThrows(invalidPropertyNames, invalidPropertyName => w.ForceSetValue(invalidPropertyName)); + + // Not registered property + Assert.ThrowsException(() => w.GetValue("1")); + Assert.ThrowsException(() => w.SetValue("1")); + Assert.ThrowsException(() => w.ForceSetValue("1")); + + // Actual Get/Set/ForceSetValue tests + Test("Int32", typeof(int), value => value + 1, invalidInt32Values); + Test("NullableInt32", typeof(int?), value => value == null ? 0 : value.Value + 1, invalidNullableInt32Values); + Test("ITest", typeof(ITest), value => new Test(), invalidTestValues); + Test("TestBase", typeof(TestBase), value => new Test(), invalidTestValues); + Test("Test", typeof(Test), value => new Test(), invalidTestValues); + + void Test(string propertyName, Type propertyType, Func getNewValue, IEnumerable invalidValues) { - const string PROP_1 = "1"; + TValue value = getNewValue(default(TValue)); + w.RegisterProperty(propertyName, propertyType, value); + Assert.AreEqual(value, w.GetValue(propertyName)); - int prop1Value = 0; - w.RegisterProperty(PROP_1, typeof(int), prop1Value); - Assert.AreEqual(prop1Value, w.GetValue(PROP_1)); + value = getNewValue(value); + Assert.AreNotEqual(value, w.GetValue(propertyName)); - prop1Value++; - Assert.AreNotEqual(prop1Value, w.GetValue(PROP_1)); + w.SetValue(value, propertyName); + Assert.AreEqual(value, w.GetValue(propertyName)); - w.SetValue(prop1Value, PROP_1); - Assert.AreEqual(prop1Value, w.GetValue(PROP_1)); + w.SetValue(default(TValue), propertyName); + Assert.AreEqual(default(TValue), w.GetValue(propertyName)); - prop1Value++; - w.ForceSetValue(prop1Value, PROP_1); - Assert.AreEqual(prop1Value, w.GetValue(PROP_1)); + value = getNewValue(value); + w.ForceSetValue(value, propertyName); + Assert.AreEqual(value, w.GetValue(propertyName)); + + w.ForceSetValue(default(TValue), propertyName); + Assert.AreEqual(default(TValue), w.GetValue(propertyName)); // Invalid value - AllThrows(invalidInt32Values, invalidInt32Value => w.SetValue(invalidInt32Value, PROP_1)); - AllThrows(invalidInt32Values, invalidInt32Value => w.ForceSetValue(invalidInt32Value, PROP_1)); - } - - { - const string PROP_2 = "2"; - - Test prop2Value = new Test(); - w.RegisterProperty(PROP_2, typeof(Test), prop2Value); - Assert.AreEqual(prop2Value, w.GetValue(PROP_2)); - - prop2Value = new Test(); - Assert.AreNotEqual(prop2Value, w.GetValue(PROP_2)); - - w.SetValue(prop2Value, PROP_2); - Assert.AreEqual(prop2Value, w.GetValue(PROP_2)); - - prop2Value = new Test(); - w.ForceSetValue(prop2Value, PROP_2); - Assert.AreEqual(prop2Value, w.GetValue(PROP_2)); + AllThrows(invalidValues, invalidValue => w.SetValue(invalidValue, propertyName)); + AllThrows(invalidValues, invalidValue => w.ForceSetValue(invalidValue, propertyName)); } } From f70c5871ddddb9c90cc20a246a2264e1de375468 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Tue, 5 Sep 2017 18:59:11 +0200 Subject: [PATCH 085/118] Added ConstructorTest, test method names are not plural now [skip deployment] --- NotifyPropertyChangedBase.Tests/Tests.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/NotifyPropertyChangedBase.Tests/Tests.cs b/NotifyPropertyChangedBase.Tests/Tests.cs index 3eb87ba..d073b66 100644 --- a/NotifyPropertyChangedBase.Tests/Tests.cs +++ b/NotifyPropertyChangedBase.Tests/Tests.cs @@ -44,7 +44,15 @@ public sealed class Tests private readonly object[] invalidTestValues = new object[] { true, 'x', "", (byte)0, (sbyte)0, 0, 0U, 0L, 0UL, 0F, 0M, 0D }; [TestMethod] - public void RegisterPropertyTests() + public void ConstructorTest() + { + Wrapper w = new Wrapper(); + Assert.IsTrue(w.IsPropertyChangedCallbackInvokingEnabled); + Assert.IsTrue(w.IsPropertyChangedEventInvokingEnabled); + } + + [TestMethod] + public void RegisterPropertyTest() { Wrapper w = new Wrapper(); @@ -80,7 +88,7 @@ public void RegisterPropertyTests() } [TestMethod] - public void GetSetForceSetValueTests() + public void GetSetForceSetValueTest() { Wrapper w = new Wrapper(); From 7040bc470ae90ff56aefb3f1e4c8142890f9f490 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Tue, 5 Sep 2017 22:19:52 +0200 Subject: [PATCH 086/118] Added PropertyChangedEventTest, added NotifyPropertyChangedBase.Tests.Host --- ...otifyPropertyChangedBase.Tests.Host.csproj | 38 +++++++++++++ .../Program.cs | 55 +++++++++++++++++++ NotifyPropertyChangedBase.Tests/Tests.cs | 37 +++++++++++++ NotifyPropertyChangedBase.sln | 11 +++- 4 files changed, 140 insertions(+), 1 deletion(-) create mode 100644 NotifyPropertyChangedBase.Tests.Host/NotifyPropertyChangedBase.Tests.Host.csproj create mode 100644 NotifyPropertyChangedBase.Tests.Host/Program.cs diff --git a/NotifyPropertyChangedBase.Tests.Host/NotifyPropertyChangedBase.Tests.Host.csproj b/NotifyPropertyChangedBase.Tests.Host/NotifyPropertyChangedBase.Tests.Host.csproj new file mode 100644 index 0000000..da5bb06 --- /dev/null +++ b/NotifyPropertyChangedBase.Tests.Host/NotifyPropertyChangedBase.Tests.Host.csproj @@ -0,0 +1,38 @@ + + + Exe + net45;netcoreapp1.0; + NotifyPropertyChangedBase.Tests.Host + NotifyPropertyChangedBase.Tests.Host + NotifyPropertyChangedBase.Tests.Host + NotifyPropertyChangedBase.Tests.Host + Marian Dolinský + Marian Dolinský + © 2017 Marian Dolinský + 1.0.0 + 1.0.0.0 + 1.0.0.0 + https://github.com/bramborman/NotifyPropertyChangedBase + git + en-US + + + + + + + + + + + + NotifyPropertyChangedBase.Tests.Host.Net45 + NotifyPropertyChangedBase.Tests.Host.Net45 + NET_45;HAVE_COM_ATTRIBUTES + + + NotifyPropertyChangedBase.Tests.Host.NetCore + NotifyPropertyChangedBase.Tests.Host.NetCore + NETCOREAPP1_0 + + diff --git a/NotifyPropertyChangedBase.Tests.Host/Program.cs b/NotifyPropertyChangedBase.Tests.Host/Program.cs new file mode 100644 index 0000000..ad3dfbb --- /dev/null +++ b/NotifyPropertyChangedBase.Tests.Host/Program.cs @@ -0,0 +1,55 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.Diagnostics; +using System.Linq; +using System.Reflection; +using System.Text; + +namespace NotifyPropertyChangedBase.Tests.Host +{ + public static class Program + { + public static void Main(string[] args) + { + Console.CursorVisible = false; + + Tests tests = new Tests(); + Stopwatch stopwatch = new Stopwatch(); + + foreach (MethodInfo methodInfo in typeof(Tests).GetRuntimeMethods().Where(mi => mi.GetCustomAttribute(typeof(TestMethodAttribute)) != null)) + { + stopwatch.Restart(); + + try + { + methodInfo.Invoke(tests, null); + stopwatch.Stop(); + + Console.ForegroundColor = ConsoleColor.Green; + Console.WriteLine($"Success: {methodInfo.Name} ({stopwatch.ElapsedMilliseconds}ms)"); + } + catch (Exception exception) + { + stopwatch.Stop(); + Console.ForegroundColor = ConsoleColor.Red; + Console.WriteLine($"Fail: {methodInfo.Name} ({stopwatch.ElapsedMilliseconds}ms)"); + + StringBuilder stringBuilder = new StringBuilder("\t"); + + while (exception != null) + { + stringBuilder.AppendLine(exception.Message); + exception = exception.InnerException; + } + + stringBuilder.Replace(Environment.NewLine, Environment.NewLine + '\t'); + Console.WriteLine(stringBuilder.ToString()); + } + } + + Console.ForegroundColor = ConsoleColor.White; + Console.Write(Environment.NewLine + "Press any key to exit . . ."); + Console.ReadKey(true); + } + } +} diff --git a/NotifyPropertyChangedBase.Tests/Tests.cs b/NotifyPropertyChangedBase.Tests/Tests.cs index d073b66..27fe24b 100644 --- a/NotifyPropertyChangedBase.Tests/Tests.cs +++ b/NotifyPropertyChangedBase.Tests/Tests.cs @@ -137,6 +137,43 @@ void Test(string propertyName, Type propertyType, Func g } } + [TestMethod] + public void PropertyChangedEventTest() + { + const string PROP = "Int32"; + + bool propertyChangedCalled = false; + int value = 0; + Wrapper w = new Wrapper(); + + w.PropertyChanged += (sender, e) => + { + Assert.AreEqual(PROP, e.PropertyName); + Assert.AreEqual(w, sender); + + propertyChangedCalled = true; + }; + + w.RegisterProperty(PROP, typeof(int), value); + + w.SetValue(value, PROP); + Assert.IsFalse(propertyChangedCalled); + + w.ForceSetValue(value, PROP); + Assert.IsTrue(propertyChangedCalled); + propertyChangedCalled = false; + + value++; + w.SetValue(value, PROP); + Assert.IsTrue(propertyChangedCalled); + propertyChangedCalled = false; + + value++; + w.ForceSetValue(value, PROP); + Assert.IsTrue(propertyChangedCalled); + propertyChangedCalled = false; + } + private void AllThrows(IEnumerable collection, Action action) where TException : Exception { foreach (TObject item in collection) diff --git a/NotifyPropertyChangedBase.sln b/NotifyPropertyChangedBase.sln index 8ab0daa..0681019 100644 --- a/NotifyPropertyChangedBase.sln +++ b/NotifyPropertyChangedBase.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26430.16 +VisualStudioVersion = 15.0.26730.12 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{121EBC4B-EA90-4A53-8E99-B56DA7C6646F}" ProjectSection(SolutionItems) = preProject @@ -18,6 +18,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NotifyPropertyChangedBase", EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NotifyPropertyChangedBase.Tests", "NotifyPropertyChangedBase.Tests\NotifyPropertyChangedBase.Tests.csproj", "{22A1B2AF-E249-4B07-91DC-5C3E80D0567B}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotifyPropertyChangedBase.Tests.Host", "NotifyPropertyChangedBase.Tests.Host\NotifyPropertyChangedBase.Tests.Host.csproj", "{BAFF5E97-BE13-4BA2-9C91-B7FFEE761392}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -32,8 +34,15 @@ Global {22A1B2AF-E249-4B07-91DC-5C3E80D0567B}.Debug|Any CPU.Build.0 = Debug|Any CPU {22A1B2AF-E249-4B07-91DC-5C3E80D0567B}.Release|Any CPU.ActiveCfg = Release|Any CPU {22A1B2AF-E249-4B07-91DC-5C3E80D0567B}.Release|Any CPU.Build.0 = Release|Any CPU + {BAFF5E97-BE13-4BA2-9C91-B7FFEE761392}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BAFF5E97-BE13-4BA2-9C91-B7FFEE761392}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BAFF5E97-BE13-4BA2-9C91-B7FFEE761392}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BAFF5E97-BE13-4BA2-9C91-B7FFEE761392}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {ACADCF34-1D47-4B34-B71B-BBABF68640D8} + EndGlobalSection EndGlobal From 413e22ad16973764cced10a118e0eb6d7fe2aa68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Tue, 5 Sep 2017 22:22:01 +0200 Subject: [PATCH 087/118] Fixed build [skip deployment] --- AppVeyor-Build.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/AppVeyor-Build.ps1 b/AppVeyor-Build.ps1 index 9c54b9f..ca4b1cf 100644 --- a/AppVeyor-Build.ps1 +++ b/AppVeyor-Build.ps1 @@ -52,6 +52,7 @@ dotnet build NotifyPropertyChangedBase\NotifyPropertyChangedBase.csproj -c Relea Write-Host "`nTests Build" Write-Host "===========" dotnet build NotifyPropertyChangedBase.Tests\NotifyPropertyChangedBase.Tests.csproj -c Release +dotnet build NotifyPropertyChangedBase.Tests\NotifyPropertyChangedBase.Tests.Host.csproj -c Release Write-Host "`nArtifacts" Write-Host "=========" From 0cba7613ac894e19c59e5482f25de9857d6246ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Tue, 5 Sep 2017 22:26:36 +0200 Subject: [PATCH 088/118] Fuck --- AppVeyor-Build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AppVeyor-Build.ps1 b/AppVeyor-Build.ps1 index ca4b1cf..ab15859 100644 --- a/AppVeyor-Build.ps1 +++ b/AppVeyor-Build.ps1 @@ -52,7 +52,7 @@ dotnet build NotifyPropertyChangedBase\NotifyPropertyChangedBase.csproj -c Relea Write-Host "`nTests Build" Write-Host "===========" dotnet build NotifyPropertyChangedBase.Tests\NotifyPropertyChangedBase.Tests.csproj -c Release -dotnet build NotifyPropertyChangedBase.Tests\NotifyPropertyChangedBase.Tests.Host.csproj -c Release +dotnet build NotifyPropertyChangedBase.Tests.Host\NotifyPropertyChangedBase.Tests.Host.csproj -c Release Write-Host "`nArtifacts" Write-Host "=========" From b910e1e369d453330dec1e217db8cd748fd53532 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Wed, 6 Sep 2017 14:29:12 +0200 Subject: [PATCH 089/118] More tests :3 [skip deployment] --- NotifyPropertyChangedBase.Tests/Tests.cs | 39 ++++++++++++++++-------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/NotifyPropertyChangedBase.Tests/Tests.cs b/NotifyPropertyChangedBase.Tests/Tests.cs index 27fe24b..c6a4f8f 100644 --- a/NotifyPropertyChangedBase.Tests/Tests.cs +++ b/NotifyPropertyChangedBase.Tests/Tests.cs @@ -156,22 +156,35 @@ public void PropertyChangedEventTest() w.RegisterProperty(PROP, typeof(int), value); - w.SetValue(value, PROP); - Assert.IsFalse(propertyChangedCalled); - - w.ForceSetValue(value, PROP); - Assert.IsTrue(propertyChangedCalled); - propertyChangedCalled = false; - + Test(false, false); + Test(true, true); value++; - w.SetValue(value, PROP); - Assert.IsTrue(propertyChangedCalled); - propertyChangedCalled = false; + Test(false, true); + value++; + Test(true, true); + w.IsPropertyChangedEventInvokingEnabled = false; + Test(false, false); + Test(true, false); + value++; + Test(false, false); value++; - w.ForceSetValue(value, PROP); - Assert.IsTrue(propertyChangedCalled); - propertyChangedCalled = false; + Test(true, false); + + void Test(bool force, bool shouldCallPropertyChanged) + { + if (force) + { + w.ForceSetValue(value, PROP); + } + else + { + w.SetValue(value, PROP); + } + + Assert.AreEqual(shouldCallPropertyChanged, propertyChangedCalled); + propertyChangedCalled = false; + } } private void AllThrows(IEnumerable collection, Action action) where TException : Exception From 672d422a33625bc8fc13e08372838e49e4794a1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Wed, 6 Sep 2017 21:37:53 +0200 Subject: [PATCH 090/118] Merged GetSetForceSetValueTest and PropertyChangedEventTest to avoid code duplicates and test more --- NotifyPropertyChangedBase.Tests/Tests.cs | 113 ++++++++++------------- 1 file changed, 50 insertions(+), 63 deletions(-) diff --git a/NotifyPropertyChangedBase.Tests/Tests.cs b/NotifyPropertyChangedBase.Tests/Tests.cs index c6a4f8f..74923d0 100644 --- a/NotifyPropertyChangedBase.Tests/Tests.cs +++ b/NotifyPropertyChangedBase.Tests/Tests.cs @@ -26,6 +26,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; +using System.ComponentModel; namespace NotifyPropertyChangedBase.Tests { @@ -111,79 +112,65 @@ public void GetSetForceSetValueTest() void Test(string propertyName, Type propertyType, Func getNewValue, IEnumerable invalidValues) { - TValue value = getNewValue(default(TValue)); - w.RegisterProperty(propertyName, propertyType, value); - Assert.AreEqual(value, w.GetValue(propertyName)); + bool propertyChangedEventInvoked = false; - value = getNewValue(value); - Assert.AreNotEqual(value, w.GetValue(propertyName)); - - w.SetValue(value, propertyName); - Assert.AreEqual(value, w.GetValue(propertyName)); + PropertyChangedEventHandler propertyChangedEventHandler = (sender, e) => + { + Assert.AreEqual(propertyName, e.PropertyName); + Assert.AreEqual(w, sender); - w.SetValue(default(TValue), propertyName); - Assert.AreEqual(default(TValue), w.GetValue(propertyName)); + propertyChangedEventInvoked = true; + }; - value = getNewValue(value); - w.ForceSetValue(value, propertyName); - Assert.AreEqual(value, w.GetValue(propertyName)); + w.PropertyChanged += propertyChangedEventHandler; - w.ForceSetValue(default(TValue), propertyName); - Assert.AreEqual(default(TValue), w.GetValue(propertyName)); + RunTest(true); + propertyName += "_NoPropertyChangedEvent"; + RunTest(false); + w.IsPropertyChangedEventInvokingEnabled = true; + + w.PropertyChanged -= propertyChangedEventHandler; // Invalid value AllThrows(invalidValues, invalidValue => w.SetValue(invalidValue, propertyName)); AllThrows(invalidValues, invalidValue => w.ForceSetValue(invalidValue, propertyName)); - } - } - - [TestMethod] - public void PropertyChangedEventTest() - { - const string PROP = "Int32"; - - bool propertyChangedCalled = false; - int value = 0; - Wrapper w = new Wrapper(); - - w.PropertyChanged += (sender, e) => - { - Assert.AreEqual(PROP, e.PropertyName); - Assert.AreEqual(w, sender); - - propertyChangedCalled = true; - }; - - w.RegisterProperty(PROP, typeof(int), value); - - Test(false, false); - Test(true, true); - value++; - Test(false, true); - value++; - Test(true, true); - - w.IsPropertyChangedEventInvokingEnabled = false; - Test(false, false); - Test(true, false); - value++; - Test(false, false); - value++; - Test(true, false); - - void Test(bool force, bool shouldCallPropertyChanged) - { - if (force) - { - w.ForceSetValue(value, PROP); - } - else + + void RunTest(bool isPropertyChangedEventInvokingEnabled) { - w.SetValue(value, PROP); + w.IsPropertyChangedEventInvokingEnabled = isPropertyChangedEventInvokingEnabled; + + TValue value = getNewValue(default(TValue)); + w.RegisterProperty(propertyName, propertyType, value); + Assert.AreEqual(value, w.GetValue(propertyName)); + CheckPropertyChangedInvoked(false); + + value = getNewValue(value); + Assert.AreNotEqual(value, w.GetValue(propertyName)); + CheckPropertyChangedInvoked(false); + + w.SetValue(value, propertyName); + Assert.AreEqual(value, w.GetValue(propertyName)); + CheckPropertyChangedInvoked(isPropertyChangedEventInvokingEnabled); + + w.SetValue(default(TValue), propertyName); + Assert.AreEqual(default(TValue), w.GetValue(propertyName)); + CheckPropertyChangedInvoked(isPropertyChangedEventInvokingEnabled); + + value = getNewValue(value); + w.ForceSetValue(value, propertyName); + Assert.AreEqual(value, w.GetValue(propertyName)); + CheckPropertyChangedInvoked(isPropertyChangedEventInvokingEnabled); + + w.ForceSetValue(default(TValue), propertyName); + Assert.AreEqual(default(TValue), w.GetValue(propertyName)); + CheckPropertyChangedInvoked(isPropertyChangedEventInvokingEnabled); + + void CheckPropertyChangedInvoked(bool expectedValue) + { + Assert.AreEqual(expectedValue, propertyChangedEventInvoked); + propertyChangedEventInvoked = false; + } } - - Assert.AreEqual(shouldCallPropertyChanged, propertyChangedCalled); - propertyChangedCalled = false; } } From 85571270e0cb10e56ad0045df154f4bfa8433c6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Wed, 6 Sep 2017 23:08:36 +0200 Subject: [PATCH 091/118] =?UTF-8?q?Refactoring=20unit=20tests,=20stage=201?= =?UTF-8?q?=20of=20=E2=88=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NotifyPropertyChangedBase.Tests/Tests.cs | 73 +++++++++++++++--------- 1 file changed, 45 insertions(+), 28 deletions(-) diff --git a/NotifyPropertyChangedBase.Tests/Tests.cs b/NotifyPropertyChangedBase.Tests/Tests.cs index 74923d0..3d5ce1e 100644 --- a/NotifyPropertyChangedBase.Tests/Tests.cs +++ b/NotifyPropertyChangedBase.Tests/Tests.cs @@ -33,17 +33,42 @@ namespace NotifyPropertyChangedBase.Tests [TestClass] public sealed class Tests { + private sealed class TypeData + { + public Type Type { get; } + public Tuple DefaultValues { get; } + public Func GetNewValue { get; } + public object[] InvalidValues { get; } + + public TypeData(Type type, Tuple defaultValues, Func getNewValue, object[] invalidValues) + { + Type = type; + DefaultValues = defaultValues; + GetNewValue = getNewValue; + InvalidValues = invalidValues; + } + } + // U = uint // L = long // UL = ulong // F = float // M = decimal // D = double - private readonly string[] invalidPropertyNames = new string[] { null, "", "\n\t \v\r" }; - private readonly object[] invalidInt32Values = new object[] { null, true, 'x', "", (byte)0, (sbyte)0, 0U, 0L, 0UL, 0F, 0M, 0D, new Test() }; - private readonly object[] invalidNullableInt32Values = new object[] { true, 'x', "", (byte)0, (sbyte)0, 0U, 0L, 0UL, 0F, 0M, 0D, new Test() }; - private readonly object[] invalidTestValues = new object[] { true, 'x', "", (byte)0, (sbyte)0, 0, 0U, 0L, 0UL, 0F, 0M, 0D }; - + private static readonly string[] invalidPropertyNames = new string[] { null, "", "\n\t \v\r" }; + private static readonly object[] invalidInt32Values = new object[] { null, true, 'x', "", (byte)0, (sbyte)0, 0U, 0L, 0UL, 0F, 0M, 0D, new Test() }; + private static readonly object[] invalidNullableInt32Values = new object[] { true, 'x', "", (byte)0, (sbyte)0, 0U, 0L, 0UL, 0F, 0M, 0D, new Test() }; + private static readonly object[] invalidTestValues = new object[] { true, 'x', "", (byte)0, (sbyte)0, 0, 0U, 0L, 0UL, 0F, 0M, 0D }; + private static readonly List typeDataCollection = new List() + { + new TypeData(typeof(int), new Tuple(0, 0), value => (int)value + 1, new object[] { null, true, 'x', "", (byte)0, (sbyte)0, 0U, 0L, 0UL, 0F, 0M, 0D, new Test() }), + new TypeData(typeof(int?), new Tuple(null, 0), value => value == null ? 0 : ((int?)value).Value + 1, new object[] { true, 'x', "", (byte)0, (sbyte)0, 0U, 0L, 0UL, 0F, 0M, 0D, new Test() }), + new TypeData(typeof(uint), new Tuple(0U, 0U), value => (uint)value + 1, new object[] { null, true, 'x', "", (byte)0, (sbyte)0, 0, 0L, 0UL, 0F, 0M, 0D, new Test() }), + new TypeData(typeof(ITest), new Tuple(null, new Test()), value => new Test(), invalidTestValues), + new TypeData(typeof(TestBase), new Tuple(null, new Test()), value => new Test(), invalidTestValues), + new TypeData(typeof(Test), new Tuple(null, new Test()), value => new Test(), invalidTestValues) + }; + [TestMethod] public void ConstructorTest() { @@ -61,31 +86,23 @@ public void RegisterPropertyTest() AllThrows(invalidPropertyNames, invalidPropertyName => w.RegisterProperty(invalidPropertyName, typeof(int), 0)); // Invalid type argument - Assert.ThrowsException(() => w.RegisterProperty("P", null, 0)); - - // Invalid default value - AllThrows(invalidInt32Values, invalidInt32Value => w.RegisterProperty("P", typeof(int), invalidInt32Value)); - AllThrows(invalidNullableInt32Values, invalidNullableInt32Value => w.RegisterProperty("P", typeof(int?), invalidNullableInt32Value)); - Assert.ThrowsException(() => w.RegisterProperty("P", typeof(uint), -1)); - AllThrows(invalidTestValues, invalidTestValue => w.RegisterProperty("P", typeof(ITest), invalidTestValue)); - AllThrows(invalidTestValues, invalidTestValue => w.RegisterProperty("P", typeof(TestBase), invalidTestValue)); - AllThrows(invalidTestValues, invalidTestValue => w.RegisterProperty("P", typeof(Test), invalidTestValue)); - - const string PROP_INT32 = "Int32"; - - // Valid default values - w.RegisterProperty(PROP_INT32, typeof(int), 0); - w.RegisterProperty("Nullable1", typeof(int?), null); - w.RegisterProperty("Nullable2", typeof(int?), 0); - w.RegisterProperty("ITest", typeof(ITest), null); - w.RegisterProperty("ITest2", typeof(ITest), new Test()); - w.RegisterProperty("TestBase", typeof(TestBase), null); - w.RegisterProperty("TestBase2", typeof(TestBase), new Test()); - w.RegisterProperty("Test", typeof(Test), null); - w.RegisterProperty("Test2", typeof(Test), new Test()); + Assert.ThrowsException(() => w.RegisterProperty("InvalidTypeArgument", null, 0)); + + foreach (TypeData typeData in typeDataCollection) + { + // Valid arguments + w.RegisterProperty(typeData.Type.Name + '1', typeData.Type, typeData.DefaultValues.Item1); + w.RegisterProperty(typeData.Type.Name + '2', typeData.Type, typeData.DefaultValues.Item2); + + // Invalid default values + AllThrows(typeData.InvalidValues, invalidValue => + { + w.RegisterProperty(typeData.Type.Name + "_InvalidDefaultValue", typeData.Type, invalidValue); + }); + } // Registering another property with the same name - Assert.ThrowsException(() => w.RegisterProperty(PROP_INT32, typeof(int), 0)); + Assert.ThrowsException(() => w.RegisterProperty(typeDataCollection[0].Type.Name + '1', typeof(int), 0)); } [TestMethod] From 9a9bcb8d268d42430fee5bccc21195d01f6042b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Wed, 6 Sep 2017 23:27:42 +0200 Subject: [PATCH 092/118] Stage 2 - improvements and bugfixes [skip deployment] (I always forget about that skipping :(( ) --- NotifyPropertyChangedBase.Tests/Tests.cs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/NotifyPropertyChangedBase.Tests/Tests.cs b/NotifyPropertyChangedBase.Tests/Tests.cs index 3d5ce1e..6e54dac 100644 --- a/NotifyPropertyChangedBase.Tests/Tests.cs +++ b/NotifyPropertyChangedBase.Tests/Tests.cs @@ -91,8 +91,13 @@ public void RegisterPropertyTest() foreach (TypeData typeData in typeDataCollection) { // Valid arguments - w.RegisterProperty(typeData.Type.Name + '1', typeData.Type, typeData.DefaultValues.Item1); - w.RegisterProperty(typeData.Type.Name + '2', typeData.Type, typeData.DefaultValues.Item2); + string propertyName1 = typeData.Type.Name + '1'; + w.RegisterProperty(propertyName1, typeData.Type, typeData.DefaultValues.Item1); + Assert.AreEqual(typeData.DefaultValues.Item1, w.GetValue(propertyName1)); + + string propertyName2 = typeData.Type.Name + '2'; + w.RegisterProperty(propertyName2, typeData.Type, typeData.DefaultValues.Item2); + Assert.AreEqual(typeData.DefaultValues.Item2, w.GetValue(propertyName2)); // Invalid default values AllThrows(typeData.InvalidValues, invalidValue => @@ -101,7 +106,7 @@ public void RegisterPropertyTest() }); } - // Registering another property with the same name + // Registering another property with a name of already registered property Assert.ThrowsException(() => w.RegisterProperty(typeDataCollection[0].Type.Name + '1', typeof(int), 0)); } @@ -112,13 +117,13 @@ public void GetSetForceSetValueTest() // Invalid property name AllThrows(invalidPropertyNames, invalidPropertyName => w.GetValue(invalidPropertyName)); - AllThrows(invalidPropertyNames, invalidPropertyName => w.SetValue(invalidPropertyName)); - AllThrows(invalidPropertyNames, invalidPropertyName => w.ForceSetValue(invalidPropertyName)); + AllThrows(invalidPropertyNames, invalidPropertyName => w.SetValue(null, invalidPropertyName)); + AllThrows(invalidPropertyNames, invalidPropertyName => w.ForceSetValue(null, invalidPropertyName)); // Not registered property Assert.ThrowsException(() => w.GetValue("1")); - Assert.ThrowsException(() => w.SetValue("1")); - Assert.ThrowsException(() => w.ForceSetValue("1")); + Assert.ThrowsException(() => w.SetValue(null, "1")); + Assert.ThrowsException(() => w.ForceSetValue(null, "1")); // Actual Get/Set/ForceSetValue tests Test("Int32", typeof(int), value => value + 1, invalidInt32Values); From 1cca51a81f07652168675c22fbe79ee4cb06afa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 7 Sep 2017 12:42:51 +0200 Subject: [PATCH 093/118] Another one [skip deployment] --- .../Program.cs | 4 + NotifyPropertyChangedBase.Tests/Tests.cs | 156 +++++++++--------- NotifyPropertyChangedBase.Tests/Wrapper.cs | 8 +- 3 files changed, 85 insertions(+), 83 deletions(-) diff --git a/NotifyPropertyChangedBase.Tests.Host/Program.cs b/NotifyPropertyChangedBase.Tests.Host/Program.cs index ad3dfbb..370fd22 100644 --- a/NotifyPropertyChangedBase.Tests.Host/Program.cs +++ b/NotifyPropertyChangedBase.Tests.Host/Program.cs @@ -35,13 +35,17 @@ public static void Main(string[] args) Console.WriteLine($"Fail: {methodInfo.Name} ({stopwatch.ElapsedMilliseconds}ms)"); StringBuilder stringBuilder = new StringBuilder("\t"); + string stackTrace = exception.InnerException.StackTrace; while (exception != null) { stringBuilder.AppendLine(exception.Message); + exception = exception.InnerException; } + stringBuilder.AppendLine(stackTrace); + stringBuilder.Replace(Environment.NewLine, Environment.NewLine + '\t'); Console.WriteLine(stringBuilder.ToString()); } diff --git a/NotifyPropertyChangedBase.Tests/Tests.cs b/NotifyPropertyChangedBase.Tests/Tests.cs index 6e54dac..76f39de 100644 --- a/NotifyPropertyChangedBase.Tests/Tests.cs +++ b/NotifyPropertyChangedBase.Tests/Tests.cs @@ -33,22 +33,6 @@ namespace NotifyPropertyChangedBase.Tests [TestClass] public sealed class Tests { - private sealed class TypeData - { - public Type Type { get; } - public Tuple DefaultValues { get; } - public Func GetNewValue { get; } - public object[] InvalidValues { get; } - - public TypeData(Type type, Tuple defaultValues, Func getNewValue, object[] invalidValues) - { - Type = type; - DefaultValues = defaultValues; - GetNewValue = getNewValue; - InvalidValues = invalidValues; - } - } - // U = uint // L = long // UL = ulong @@ -58,12 +42,13 @@ public TypeData(Type type, Tuple defaultValues, Func typeDataCollection = new List() { - new TypeData(typeof(int), new Tuple(0, 0), value => (int)value + 1, new object[] { null, true, 'x', "", (byte)0, (sbyte)0, 0U, 0L, 0UL, 0F, 0M, 0D, new Test() }), - new TypeData(typeof(int?), new Tuple(null, 0), value => value == null ? 0 : ((int?)value).Value + 1, new object[] { true, 'x', "", (byte)0, (sbyte)0, 0U, 0L, 0UL, 0F, 0M, 0D, new Test() }), - new TypeData(typeof(uint), new Tuple(0U, 0U), value => (uint)value + 1, new object[] { null, true, 'x', "", (byte)0, (sbyte)0, 0, 0L, 0UL, 0F, 0M, 0D, new Test() }), + new TypeData(typeof(int), new Tuple(0, 0), value => (int)value + 1, invalidInt32Values), + new TypeData(typeof(int?), new Tuple(null, 0), value => value == null ? 0 : ((int?)value).Value + 1, invalidNullableInt32Values), + new TypeData(typeof(uint), new Tuple(0U, 0U), value => (uint)value + 1, invalidUInt32Values), new TypeData(typeof(ITest), new Tuple(null, new Test()), value => new Test(), invalidTestValues), new TypeData(typeof(TestBase), new Tuple(null, new Test()), value => new Test(), invalidTestValues), new TypeData(typeof(Test), new Tuple(null, new Test()), value => new Test(), invalidTestValues) @@ -121,76 +106,73 @@ public void GetSetForceSetValueTest() AllThrows(invalidPropertyNames, invalidPropertyName => w.ForceSetValue(null, invalidPropertyName)); // Not registered property - Assert.ThrowsException(() => w.GetValue("1")); - Assert.ThrowsException(() => w.SetValue(null, "1")); - Assert.ThrowsException(() => w.ForceSetValue(null, "1")); - - // Actual Get/Set/ForceSetValue tests - Test("Int32", typeof(int), value => value + 1, invalidInt32Values); - Test("NullableInt32", typeof(int?), value => value == null ? 0 : value.Value + 1, invalidNullableInt32Values); - Test("ITest", typeof(ITest), value => new Test(), invalidTestValues); - Test("TestBase", typeof(TestBase), value => new Test(), invalidTestValues); - Test("Test", typeof(Test), value => new Test(), invalidTestValues); - - void Test(string propertyName, Type propertyType, Func getNewValue, IEnumerable invalidValues) + Assert.ThrowsException(() => w.GetValue("NotRegisteredProperty")); + Assert.ThrowsException(() => w.SetValue(null, "NotRegisteredProperty")); + Assert.ThrowsException(() => w.ForceSetValue(null, "NotRegisteredProperty")); + + bool propertyChangedEventInvoked = false; + string propertyName = null; + + w.PropertyChanged += (sender, e) => { - bool propertyChangedEventInvoked = false; + Assert.AreEqual(propertyName, e.PropertyName); + Assert.AreEqual(w, sender); - PropertyChangedEventHandler propertyChangedEventHandler = (sender, e) => - { - Assert.AreEqual(propertyName, e.PropertyName); - Assert.AreEqual(w, sender); + propertyChangedEventInvoked = true; + }; - propertyChangedEventInvoked = true; - }; - - w.PropertyChanged += propertyChangedEventHandler; - - RunTest(true); - propertyName += "_NoPropertyChangedEvent"; - RunTest(false); - w.IsPropertyChangedEventInvokingEnabled = true; - - w.PropertyChanged -= propertyChangedEventHandler; + foreach (TypeData typeData in typeDataCollection) + { + propertyName = typeData.Type.Name; + Test(true); + propertyName = typeData.Type.Name + "_NoPropertyChangedEvent"; + Test(false); // Invalid value - AllThrows(invalidValues, invalidValue => w.SetValue(invalidValue, propertyName)); - AllThrows(invalidValues, invalidValue => w.ForceSetValue(invalidValue, propertyName)); + AllThrows(typeData.InvalidValues, invalidValue => w.SetValue(invalidValue, propertyName)); + AllThrows(typeData.InvalidValues, invalidValue => w.ForceSetValue(invalidValue, propertyName)); - void RunTest(bool isPropertyChangedEventInvokingEnabled) + void Test(bool isPropertyChangedEventInvokingEnabled) { w.IsPropertyChangedEventInvokingEnabled = isPropertyChangedEventInvokingEnabled; + RunTest(typeData.DefaultValues.Item1, '1'); + RunTest(typeData.DefaultValues.Item2, '2'); - TValue value = getNewValue(default(TValue)); - w.RegisterProperty(propertyName, propertyType, value); - Assert.AreEqual(value, w.GetValue(propertyName)); - CheckPropertyChangedInvoked(false); - - value = getNewValue(value); - Assert.AreNotEqual(value, w.GetValue(propertyName)); - CheckPropertyChangedInvoked(false); - - w.SetValue(value, propertyName); - Assert.AreEqual(value, w.GetValue(propertyName)); - CheckPropertyChangedInvoked(isPropertyChangedEventInvokingEnabled); - - w.SetValue(default(TValue), propertyName); - Assert.AreEqual(default(TValue), w.GetValue(propertyName)); - CheckPropertyChangedInvoked(isPropertyChangedEventInvokingEnabled); - - value = getNewValue(value); - w.ForceSetValue(value, propertyName); - Assert.AreEqual(value, w.GetValue(propertyName)); - CheckPropertyChangedInvoked(isPropertyChangedEventInvokingEnabled); - - w.ForceSetValue(default(TValue), propertyName); - Assert.AreEqual(default(TValue), w.GetValue(propertyName)); - CheckPropertyChangedInvoked(isPropertyChangedEventInvokingEnabled); - - void CheckPropertyChangedInvoked(bool expectedValue) + void RunTest(object defaultValue, char propertyNameSuffix) { - Assert.AreEqual(expectedValue, propertyChangedEventInvoked); - propertyChangedEventInvoked = false; + propertyName += propertyNameSuffix; + + object value = defaultValue; + w.RegisterProperty(propertyName, typeData.Type, value); + Assert.AreEqual(value, w.GetValue(propertyName)); + CheckPropertyChangedInvoked(false); + + value = typeData.GetNewValue(value); + Assert.AreNotEqual(value, w.GetValue(propertyName)); + CheckPropertyChangedInvoked(false); + + w.SetValue(value, propertyName); + Assert.AreEqual(value, w.GetValue(propertyName)); + CheckPropertyChangedInvoked(isPropertyChangedEventInvokingEnabled); + + w.SetValue(defaultValue, propertyName); + Assert.AreEqual(defaultValue, w.GetValue(propertyName)); + CheckPropertyChangedInvoked(isPropertyChangedEventInvokingEnabled); + + value = typeData.GetNewValue(value); + w.ForceSetValue(value, propertyName); + Assert.AreEqual(value, w.GetValue(propertyName)); + CheckPropertyChangedInvoked(isPropertyChangedEventInvokingEnabled); + + w.ForceSetValue(defaultValue, propertyName); + Assert.AreEqual(defaultValue, w.GetValue(propertyName)); + CheckPropertyChangedInvoked(isPropertyChangedEventInvokingEnabled); + + void CheckPropertyChangedInvoked(bool expectedValue) + { + Assert.AreEqual(expectedValue, propertyChangedEventInvoked); + propertyChangedEventInvoked = false; + } } } } @@ -218,5 +200,21 @@ private sealed class Test : TestBase { } + + private sealed class TypeData + { + public Type Type { get; } + public Tuple DefaultValues { get; } + public Func GetNewValue { get; } + public object[] InvalidValues { get; } + + public TypeData(Type type, Tuple defaultValues, Func getNewValue, object[] invalidValues) + { + Type = type; + DefaultValues = defaultValues; + GetNewValue = getNewValue; + InvalidValues = invalidValues; + } + } } } diff --git a/NotifyPropertyChangedBase.Tests/Wrapper.cs b/NotifyPropertyChangedBase.Tests/Wrapper.cs index 6e20429..fcc754f 100644 --- a/NotifyPropertyChangedBase.Tests/Wrapper.cs +++ b/NotifyPropertyChangedBase.Tests/Wrapper.cs @@ -61,22 +61,22 @@ internal sealed class Wrapper : NotifyPropertyChanged base.UnregisterPropertyChangedCallback(propertyName, propertyChangedCallback); } - internal new object GetValue([CallerMemberName]string propertyName = null) + internal new object GetValue(string propertyName) { return base.GetValue(propertyName); } - internal new void ForceSetValue(object value, [CallerMemberName]string propertyName = null) + internal new void ForceSetValue(object value, string propertyName) { base.ForceSetValue(value, propertyName); } - internal new void SetValue(object value, [CallerMemberName]string propertyName = null) + internal new void SetValue(object value, string propertyName) { base.SetValue(value, propertyName); } - internal new void OnPropertyChanged([CallerMemberName]string propertyName = null) + internal new void OnPropertyChanged(string propertyName) { base.OnPropertyChanged(propertyName); } From 02461954e7b1ab012831a2e3290dfd952886e696 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 7 Sep 2017 15:30:08 +0200 Subject: [PATCH 094/118] And another one [skip deployment] --- .../Program.cs | 5 +- NotifyPropertyChangedBase.Tests/Tests.cs | 46 +++++++++++++------ 2 files changed, 37 insertions(+), 14 deletions(-) diff --git a/NotifyPropertyChangedBase.Tests.Host/Program.cs b/NotifyPropertyChangedBase.Tests.Host/Program.cs index 370fd22..eec164f 100644 --- a/NotifyPropertyChangedBase.Tests.Host/Program.cs +++ b/NotifyPropertyChangedBase.Tests.Host/Program.cs @@ -35,7 +35,10 @@ public static void Main(string[] args) Console.WriteLine($"Fail: {methodInfo.Name} ({stopwatch.ElapsedMilliseconds}ms)"); StringBuilder stringBuilder = new StringBuilder("\t"); - string stackTrace = exception.InnerException.StackTrace; + + // First exception is telling just that invoking method failed + exception = exception.InnerException; + string stackTrace = exception.StackTrace; while (exception != null) { diff --git a/NotifyPropertyChangedBase.Tests/Tests.cs b/NotifyPropertyChangedBase.Tests/Tests.cs index 76f39de..b1b91bf 100644 --- a/NotifyPropertyChangedBase.Tests/Tests.cs +++ b/NotifyPropertyChangedBase.Tests/Tests.cs @@ -96,7 +96,7 @@ public void RegisterPropertyTest() } [TestMethod] - public void GetSetForceSetValueTest() + public void WorkingWithPropertiesTest() { Wrapper w = new Wrapper(); @@ -144,29 +144,49 @@ void RunTest(object defaultValue, char propertyNameSuffix) object value = defaultValue; w.RegisterProperty(propertyName, typeData.Type, value); + + // Default value Assert.AreEqual(value, w.GetValue(propertyName)); CheckPropertyChangedInvoked(false); + // No change in value + SetAndTest(false, false); + SetAndTest(true, isPropertyChangedEventInvokingEnabled); + + // Changing value but not assigning it to property value = typeData.GetNewValue(value); Assert.AreNotEqual(value, w.GetValue(propertyName)); CheckPropertyChangedInvoked(false); - w.SetValue(value, propertyName); - Assert.AreEqual(value, w.GetValue(propertyName)); - CheckPropertyChangedInvoked(isPropertyChangedEventInvokingEnabled); + // Assigning changed value + SetAndTest(false, isPropertyChangedEventInvokingEnabled); - w.SetValue(defaultValue, propertyName); - Assert.AreEqual(defaultValue, w.GetValue(propertyName)); - CheckPropertyChangedInvoked(isPropertyChangedEventInvokingEnabled); + // Assigning default value e.g. null etc. + value = defaultValue; + SetAndTest(false, isPropertyChangedEventInvokingEnabled); + // Forcing changed value value = typeData.GetNewValue(value); - w.ForceSetValue(value, propertyName); - Assert.AreEqual(value, w.GetValue(propertyName)); - CheckPropertyChangedInvoked(isPropertyChangedEventInvokingEnabled); + SetAndTest(true, isPropertyChangedEventInvokingEnabled); - w.ForceSetValue(defaultValue, propertyName); - Assert.AreEqual(defaultValue, w.GetValue(propertyName)); - CheckPropertyChangedInvoked(isPropertyChangedEventInvokingEnabled); + // Forcing default value + value = defaultValue; + SetAndTest(true, isPropertyChangedEventInvokingEnabled); + + void SetAndTest(bool force, bool shouldInvokePropertyChangedEvent) + { + if (force) + { + w.ForceSetValue(value, propertyName); + } + else + { + w.SetValue(value, propertyName); + } + + Assert.AreEqual(value, w.GetValue(propertyName)); + CheckPropertyChangedInvoked(shouldInvokePropertyChangedEvent); + } void CheckPropertyChangedInvoked(bool expectedValue) { From 97b16a4a13d0acee7a9e67a55bfe1183ed881f40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 7 Sep 2017 21:42:03 +0200 Subject: [PATCH 095/118] Kill me. Had to rewrite all of those changes because I mistakenly clicked on Undo button in VS. I HATE MY LIFE SOOO MUCH --- NotifyPropertyChangedBase.Tests/Tests.cs | 129 +++++++++++------------ 1 file changed, 64 insertions(+), 65 deletions(-) diff --git a/NotifyPropertyChangedBase.Tests/Tests.cs b/NotifyPropertyChangedBase.Tests/Tests.cs index b1b91bf..bdd9883 100644 --- a/NotifyPropertyChangedBase.Tests/Tests.cs +++ b/NotifyPropertyChangedBase.Tests/Tests.cs @@ -46,12 +46,12 @@ public sealed class Tests private static readonly object[] invalidTestValues = new object[] { true, 'x', "", (byte)0, (sbyte)0, 0, 0U, 0L, 0UL, 0F, 0M, 0D }; private static readonly List typeDataCollection = new List() { - new TypeData(typeof(int), new Tuple(0, 0), value => (int)value + 1, invalidInt32Values), - new TypeData(typeof(int?), new Tuple(null, 0), value => value == null ? 0 : ((int?)value).Value + 1, invalidNullableInt32Values), - new TypeData(typeof(uint), new Tuple(0U, 0U), value => (uint)value + 1, invalidUInt32Values), - new TypeData(typeof(ITest), new Tuple(null, new Test()), value => new Test(), invalidTestValues), - new TypeData(typeof(TestBase), new Tuple(null, new Test()), value => new Test(), invalidTestValues), - new TypeData(typeof(Test), new Tuple(null, new Test()), value => new Test(), invalidTestValues) + new TypeData(typeof(int), new object[] { 0 }, value => (int)value + 1, invalidInt32Values), + new TypeData(typeof(int?), new object[] { null, 0 }, value => value == null ? 0 : ((int?)value).Value + 1, invalidNullableInt32Values), + new TypeData(typeof(uint), new object[] { 0U }, value => (uint)value + 1, invalidUInt32Values), + new TypeData(typeof(ITest), new object[] { null, new Test() }, value => new Test(), invalidTestValues), + new TypeData(typeof(TestBase), new object[] { null, new Test() }, value => new Test(), invalidTestValues), + new TypeData(typeof(Test), new object[] { null, new Test() }, value => new Test(), invalidTestValues) }; [TestMethod] @@ -76,13 +76,14 @@ public void RegisterPropertyTest() foreach (TypeData typeData in typeDataCollection) { // Valid arguments - string propertyName1 = typeData.Type.Name + '1'; - w.RegisterProperty(propertyName1, typeData.Type, typeData.DefaultValues.Item1); - Assert.AreEqual(typeData.DefaultValues.Item1, w.GetValue(propertyName1)); + for (int i = 0; i < typeData.DefaultValues.Length; i++) + { + string propertyName = typeData.Type.Name + i; + object defaultValue = typeData.DefaultValues[i]; - string propertyName2 = typeData.Type.Name + '2'; - w.RegisterProperty(propertyName2, typeData.Type, typeData.DefaultValues.Item2); - Assert.AreEqual(typeData.DefaultValues.Item2, w.GetValue(propertyName2)); + w.RegisterProperty(propertyName, typeData.Type, defaultValue); + Assert.AreEqual(defaultValue, w.GetValue(propertyName)); + } // Invalid default values AllThrows(typeData.InvalidValues, invalidValue => @@ -92,7 +93,7 @@ public void RegisterPropertyTest() } // Registering another property with a name of already registered property - Assert.ThrowsException(() => w.RegisterProperty(typeDataCollection[0].Type.Name + '1', typeof(int), 0)); + Assert.ThrowsException(() => w.RegisterProperty(typeDataCollection[0].Type.Name + '0', typeof(int), 0)); } [TestMethod] @@ -123,76 +124,74 @@ public void WorkingWithPropertiesTest() foreach (TypeData typeData in typeDataCollection) { - propertyName = typeData.Type.Name; - Test(true); - propertyName = typeData.Type.Name + "_NoPropertyChangedEvent"; - Test(false); + for (int i = 0; i < typeData.DefaultValues.Length; i++) + { + object defaultValue = typeData.DefaultValues[i]; + propertyName = typeData.Type.Name + i; + Test(true, defaultValue); + propertyName += "_NoPropertyChangedEvent"; + Test(false, defaultValue); + } + // Invalid value AllThrows(typeData.InvalidValues, invalidValue => w.SetValue(invalidValue, propertyName)); AllThrows(typeData.InvalidValues, invalidValue => w.ForceSetValue(invalidValue, propertyName)); - void Test(bool isPropertyChangedEventInvokingEnabled) + void Test(bool isPropertyChangedEventInvokingEnabled, object defaultValue) { w.IsPropertyChangedEventInvokingEnabled = isPropertyChangedEventInvokingEnabled; - RunTest(typeData.DefaultValues.Item1, '1'); - RunTest(typeData.DefaultValues.Item2, '2'); - - void RunTest(object defaultValue, char propertyNameSuffix) - { - propertyName += propertyNameSuffix; - object value = defaultValue; - w.RegisterProperty(propertyName, typeData.Type, value); + object value = defaultValue; + w.RegisterProperty(propertyName, typeData.Type, value); - // Default value - Assert.AreEqual(value, w.GetValue(propertyName)); - CheckPropertyChangedInvoked(false); + // Default value + Assert.AreEqual(value, w.GetValue(propertyName)); + CheckPropertyChangedInvoked(false); - // No change in value - SetAndTest(false, false); - SetAndTest(true, isPropertyChangedEventInvokingEnabled); + // No change in value + SetAndTest(false, false); + SetAndTest(true, isPropertyChangedEventInvokingEnabled); - // Changing value but not assigning it to property - value = typeData.GetNewValue(value); - Assert.AreNotEqual(value, w.GetValue(propertyName)); - CheckPropertyChangedInvoked(false); + // Changing value but not assigning it to property + value = typeData.GetNewValue(value); + Assert.AreNotEqual(value, w.GetValue(propertyName)); + CheckPropertyChangedInvoked(false); - // Assigning changed value - SetAndTest(false, isPropertyChangedEventInvokingEnabled); + // Assigning changed value + SetAndTest(false, isPropertyChangedEventInvokingEnabled); - // Assigning default value e.g. null etc. - value = defaultValue; - SetAndTest(false, isPropertyChangedEventInvokingEnabled); + // Assigning default value e.g. null etc. + value = defaultValue; + SetAndTest(false, isPropertyChangedEventInvokingEnabled); - // Forcing changed value - value = typeData.GetNewValue(value); - SetAndTest(true, isPropertyChangedEventInvokingEnabled); + // Forcing changed value + value = typeData.GetNewValue(value); + SetAndTest(true, isPropertyChangedEventInvokingEnabled); - // Forcing default value - value = defaultValue; - SetAndTest(true, isPropertyChangedEventInvokingEnabled); + // Forcing default value + value = defaultValue; + SetAndTest(true, isPropertyChangedEventInvokingEnabled); - void SetAndTest(bool force, bool shouldInvokePropertyChangedEvent) + void SetAndTest(bool force, bool shouldInvokePropertyChangedEvent) + { + if (force) { - if (force) - { - w.ForceSetValue(value, propertyName); - } - else - { - w.SetValue(value, propertyName); - } - - Assert.AreEqual(value, w.GetValue(propertyName)); - CheckPropertyChangedInvoked(shouldInvokePropertyChangedEvent); + w.ForceSetValue(value, propertyName); } - - void CheckPropertyChangedInvoked(bool expectedValue) + else { - Assert.AreEqual(expectedValue, propertyChangedEventInvoked); - propertyChangedEventInvoked = false; + w.SetValue(value, propertyName); } + + Assert.AreEqual(value, w.GetValue(propertyName)); + CheckPropertyChangedInvoked(shouldInvokePropertyChangedEvent); + } + + void CheckPropertyChangedInvoked(bool expectedValue) + { + Assert.AreEqual(expectedValue, propertyChangedEventInvoked); + propertyChangedEventInvoked = false; } } } @@ -224,11 +223,11 @@ private sealed class Test : TestBase private sealed class TypeData { public Type Type { get; } - public Tuple DefaultValues { get; } + public object[] DefaultValues { get; } public Func GetNewValue { get; } public object[] InvalidValues { get; } - public TypeData(Type type, Tuple defaultValues, Func getNewValue, object[] invalidValues) + public TypeData(Type type, object[] defaultValues, Func getNewValue, object[] invalidValues) { Type = type; DefaultValues = defaultValues; From 70070aa55dde1b65d7535d695f6835a81e5ca40e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 7 Sep 2017 23:06:13 +0200 Subject: [PATCH 096/118] =?UTF-8?q?=F0=9F=98=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NotifyPropertyChangedBase.Tests/Tests.cs | 42 ++++++++++++++---------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/NotifyPropertyChangedBase.Tests/Tests.cs b/NotifyPropertyChangedBase.Tests/Tests.cs index bdd9883..ab6db72 100644 --- a/NotifyPropertyChangedBase.Tests/Tests.cs +++ b/NotifyPropertyChangedBase.Tests/Tests.cs @@ -129,51 +129,51 @@ public void WorkingWithPropertiesTest() object defaultValue = typeData.DefaultValues[i]; propertyName = typeData.Type.Name + i; - Test(true, defaultValue); - propertyName += "_NoPropertyChangedEvent"; - Test(false, defaultValue); + Test(false, true, defaultValue); + propertyName += "_Forced"; + Test(true, true, defaultValue); + + propertyName = typeData.Type.Name + i + "_NoPropertyChangedEvent"; + Test(false, false, defaultValue); + propertyName += "_Forced"; + Test(true, false, defaultValue); } // Invalid value AllThrows(typeData.InvalidValues, invalidValue => w.SetValue(invalidValue, propertyName)); AllThrows(typeData.InvalidValues, invalidValue => w.ForceSetValue(invalidValue, propertyName)); - void Test(bool isPropertyChangedEventInvokingEnabled, object defaultValue) + void Test(bool force, bool isPropertyChangedEventInvokingEnabled, object defaultValue) { w.IsPropertyChangedEventInvokingEnabled = isPropertyChangedEventInvokingEnabled; object value = defaultValue; - w.RegisterProperty(propertyName, typeData.Type, value); // Default value + w.RegisterProperty(propertyName, typeData.Type, value); Assert.AreEqual(value, w.GetValue(propertyName)); CheckPropertyChangedInvoked(false); - // No change in value - SetAndTest(false, false); - SetAndTest(true, isPropertyChangedEventInvokingEnabled); + CheckNoChangeSet(); // Changing value but not assigning it to property value = typeData.GetNewValue(value); + // Probably not needed but I like this ( ͡° ͜ʖ ͡°) Assert.AreNotEqual(value, w.GetValue(propertyName)); CheckPropertyChangedInvoked(false); // Assigning changed value - SetAndTest(false, isPropertyChangedEventInvokingEnabled); + SetAndTest(isPropertyChangedEventInvokingEnabled); + + CheckNoChangeSet(); // Assigning default value e.g. null etc. value = defaultValue; - SetAndTest(false, isPropertyChangedEventInvokingEnabled); + SetAndTest(isPropertyChangedEventInvokingEnabled); - // Forcing changed value - value = typeData.GetNewValue(value); - SetAndTest(true, isPropertyChangedEventInvokingEnabled); + CheckNoChangeSet(); - // Forcing default value - value = defaultValue; - SetAndTest(true, isPropertyChangedEventInvokingEnabled); - - void SetAndTest(bool force, bool shouldInvokePropertyChangedEvent) + void SetAndTest(bool shouldInvokePropertyChangedEvent) { if (force) { @@ -188,6 +188,12 @@ void SetAndTest(bool force, bool shouldInvokePropertyChangedEvent) CheckPropertyChangedInvoked(shouldInvokePropertyChangedEvent); } + void CheckNoChangeSet() + { + // No change in value + SetAndTest(force && isPropertyChangedEventInvokingEnabled); + } + void CheckPropertyChangedInvoked(bool expectedValue) { Assert.AreEqual(expectedValue, propertyChangedEventInvoked); From 434cbbe60987ea1495634607b864aa690ce4f1db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 7 Sep 2017 23:10:00 +0200 Subject: [PATCH 097/118] Shouldn't have used emoji... --- NotifyPropertyChangedBase.Tests/Tests.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NotifyPropertyChangedBase.Tests/Tests.cs b/NotifyPropertyChangedBase.Tests/Tests.cs index ab6db72..37e03d9 100644 --- a/NotifyPropertyChangedBase.Tests/Tests.cs +++ b/NotifyPropertyChangedBase.Tests/Tests.cs @@ -54,6 +54,8 @@ public sealed class Tests new TypeData(typeof(Test), new object[] { null, new Test() }, value => new Test(), invalidTestValues) }; + // Lol I broke AppVeyor + [TestMethod] public void ConstructorTest() { From 70f61b4bf68f63dfeb03385de49d09c91aba4c50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 7 Sep 2017 23:12:05 +0200 Subject: [PATCH 098/118] Had that emoji broke GitHub webhooks? lol --- NotifyPropertyChangedBase.Tests/Tests.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/NotifyPropertyChangedBase.Tests/Tests.cs b/NotifyPropertyChangedBase.Tests/Tests.cs index 37e03d9..c733259 100644 --- a/NotifyPropertyChangedBase.Tests/Tests.cs +++ b/NotifyPropertyChangedBase.Tests/Tests.cs @@ -53,8 +53,6 @@ public sealed class Tests new TypeData(typeof(TestBase), new object[] { null, new Test() }, value => new Test(), invalidTestValues), new TypeData(typeof(Test), new object[] { null, new Test() }, value => new Test(), invalidTestValues) }; - - // Lol I broke AppVeyor [TestMethod] public void ConstructorTest() From 9c90e1e49c7c9f044a9a85b1c347692a1016e9cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 7 Sep 2017 23:12:48 +0200 Subject: [PATCH 099/118] *broken --- NotifyPropertyChangedBase.Tests/Tests.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NotifyPropertyChangedBase.Tests/Tests.cs b/NotifyPropertyChangedBase.Tests/Tests.cs index c733259..20d190c 100644 --- a/NotifyPropertyChangedBase.Tests/Tests.cs +++ b/NotifyPropertyChangedBase.Tests/Tests.cs @@ -54,6 +54,8 @@ public sealed class Tests new TypeData(typeof(Test), new object[] { null, new Test() }, value => new Test(), invalidTestValues) }; + // + [TestMethod] public void ConstructorTest() { From cb23fbd17e50d278b2c908fa864afa250ff405ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 7 Sep 2017 23:15:47 +0200 Subject: [PATCH 100/118] So it's webhooks.. At least I can now sleep in peace --- NotifyPropertyChangedBase.Tests/Tests.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/NotifyPropertyChangedBase.Tests/Tests.cs b/NotifyPropertyChangedBase.Tests/Tests.cs index 20d190c..c733259 100644 --- a/NotifyPropertyChangedBase.Tests/Tests.cs +++ b/NotifyPropertyChangedBase.Tests/Tests.cs @@ -54,8 +54,6 @@ public sealed class Tests new TypeData(typeof(Test), new object[] { null, new Test() }, value => new Test(), invalidTestValues) }; - // - [TestMethod] public void ConstructorTest() { From 5a28d446e8b128c31fc3f5366e15eddb037102e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 7 Sep 2017 23:24:06 +0200 Subject: [PATCH 101/118] Cleanup or how do I call it [skip ci] --- .../Program.cs | 27 ++++++++++++++++++- NotifyPropertyChangedBase.Tests/Tests.cs | 1 - NotifyPropertyChangedBase.Tests/Wrapper.cs | 1 - 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/NotifyPropertyChangedBase.Tests.Host/Program.cs b/NotifyPropertyChangedBase.Tests.Host/Program.cs index eec164f..f463139 100644 --- a/NotifyPropertyChangedBase.Tests.Host/Program.cs +++ b/NotifyPropertyChangedBase.Tests.Host/Program.cs @@ -1,4 +1,29 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +// MIT License +// +// Copyright (c) 2017 Marian Dolinský +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Diagnostics; using System.Linq; diff --git a/NotifyPropertyChangedBase.Tests/Tests.cs b/NotifyPropertyChangedBase.Tests/Tests.cs index c733259..73d5ab0 100644 --- a/NotifyPropertyChangedBase.Tests/Tests.cs +++ b/NotifyPropertyChangedBase.Tests/Tests.cs @@ -26,7 +26,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; -using System.ComponentModel; namespace NotifyPropertyChangedBase.Tests { diff --git a/NotifyPropertyChangedBase.Tests/Wrapper.cs b/NotifyPropertyChangedBase.Tests/Wrapper.cs index fcc754f..7e4b052 100644 --- a/NotifyPropertyChangedBase.Tests/Wrapper.cs +++ b/NotifyPropertyChangedBase.Tests/Wrapper.cs @@ -24,7 +24,6 @@ // OTHER DEALINGS IN THE SOFTWARE. using System; -using System.Runtime.CompilerServices; namespace NotifyPropertyChangedBase.Tests { From 405467e3e779c4a2649b6c8b02d1dfd284db1e92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Thu, 7 Sep 2017 23:27:12 +0200 Subject: [PATCH 102/118] Updated descriptions --- NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj b/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj index 5c97b37..b7161a6 100644 --- a/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj +++ b/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj @@ -5,7 +5,7 @@ NotifyPropertyChangedBase NotifyPropertyChangedBase NotifyPropertyChangedBase - Provides a simple yet powerful implementation of INotifyPropertyChanged. + A simple to use yet powerful implementation of INotifyPropertyChanged. Marian Dolinský Marian Dolinský © 2017 Marian Dolinský diff --git a/README.md b/README.md index 3c8586b..e17be51 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![Issues](https://img.shields.io/github/issues/bramborman/NotifyPropertyChangedBase.svg)](https://github.com/bramborman/NotifyPropertyChangedBase/issues) [![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/bramborman/NotifyPropertyChangedBase/blob/master/LICENSE.md) -NotifyPropertyChangedBase provides a simple yet powerful base class `NotifyPropertyChanged` that implements the `INotifyPropertyChanged` interface. Whether you're writing UWP, Xamarin, WPF or any other app, it may help you work with data. +NotifyPropertyChangedBase provides a simple to use yet powerful base class `NotifyPropertyChanged` that implements the `INotifyPropertyChanged` interface. Whether you're writing UWP, Xamarin, WPF or any other app, it will help you work with data. ### Pre-release [![MyGet](https://img.shields.io/myget/bramborman/vpre/NotifyPropertyChangedBase.svg)][MyGet] From cc57f4ed8e05097d0139d2ab7f1ee5453316eeb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Fri, 8 Sep 2017 13:54:08 +0200 Subject: [PATCH 103/118] Replaced NotifyPropertyChanged.Tests.Host with PowerShell script calling dotnet test. Could have think about that before writing the whole app... [skip deployment] --- AppVeyor-Build.ps1 | 1 - ...otifyPropertyChangedBase.Tests.Host.csproj | 38 -------- .../Program.cs | 87 ------------------- NotifyPropertyChangedBase.sln | 6 -- Run-UnitTests.ps1 | 4 + 5 files changed, 4 insertions(+), 132 deletions(-) delete mode 100644 NotifyPropertyChangedBase.Tests.Host/NotifyPropertyChangedBase.Tests.Host.csproj delete mode 100644 NotifyPropertyChangedBase.Tests.Host/Program.cs create mode 100644 Run-UnitTests.ps1 diff --git a/AppVeyor-Build.ps1 b/AppVeyor-Build.ps1 index ab15859..9c54b9f 100644 --- a/AppVeyor-Build.ps1 +++ b/AppVeyor-Build.ps1 @@ -52,7 +52,6 @@ dotnet build NotifyPropertyChangedBase\NotifyPropertyChangedBase.csproj -c Relea Write-Host "`nTests Build" Write-Host "===========" dotnet build NotifyPropertyChangedBase.Tests\NotifyPropertyChangedBase.Tests.csproj -c Release -dotnet build NotifyPropertyChangedBase.Tests.Host\NotifyPropertyChangedBase.Tests.Host.csproj -c Release Write-Host "`nArtifacts" Write-Host "=========" diff --git a/NotifyPropertyChangedBase.Tests.Host/NotifyPropertyChangedBase.Tests.Host.csproj b/NotifyPropertyChangedBase.Tests.Host/NotifyPropertyChangedBase.Tests.Host.csproj deleted file mode 100644 index da5bb06..0000000 --- a/NotifyPropertyChangedBase.Tests.Host/NotifyPropertyChangedBase.Tests.Host.csproj +++ /dev/null @@ -1,38 +0,0 @@ - - - Exe - net45;netcoreapp1.0; - NotifyPropertyChangedBase.Tests.Host - NotifyPropertyChangedBase.Tests.Host - NotifyPropertyChangedBase.Tests.Host - NotifyPropertyChangedBase.Tests.Host - Marian Dolinský - Marian Dolinský - © 2017 Marian Dolinský - 1.0.0 - 1.0.0.0 - 1.0.0.0 - https://github.com/bramborman/NotifyPropertyChangedBase - git - en-US - - - - - - - - - - - - NotifyPropertyChangedBase.Tests.Host.Net45 - NotifyPropertyChangedBase.Tests.Host.Net45 - NET_45;HAVE_COM_ATTRIBUTES - - - NotifyPropertyChangedBase.Tests.Host.NetCore - NotifyPropertyChangedBase.Tests.Host.NetCore - NETCOREAPP1_0 - - diff --git a/NotifyPropertyChangedBase.Tests.Host/Program.cs b/NotifyPropertyChangedBase.Tests.Host/Program.cs deleted file mode 100644 index f463139..0000000 --- a/NotifyPropertyChangedBase.Tests.Host/Program.cs +++ /dev/null @@ -1,87 +0,0 @@ -// MIT License -// -// Copyright (c) 2017 Marian Dolinský -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. - -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System; -using System.Diagnostics; -using System.Linq; -using System.Reflection; -using System.Text; - -namespace NotifyPropertyChangedBase.Tests.Host -{ - public static class Program - { - public static void Main(string[] args) - { - Console.CursorVisible = false; - - Tests tests = new Tests(); - Stopwatch stopwatch = new Stopwatch(); - - foreach (MethodInfo methodInfo in typeof(Tests).GetRuntimeMethods().Where(mi => mi.GetCustomAttribute(typeof(TestMethodAttribute)) != null)) - { - stopwatch.Restart(); - - try - { - methodInfo.Invoke(tests, null); - stopwatch.Stop(); - - Console.ForegroundColor = ConsoleColor.Green; - Console.WriteLine($"Success: {methodInfo.Name} ({stopwatch.ElapsedMilliseconds}ms)"); - } - catch (Exception exception) - { - stopwatch.Stop(); - Console.ForegroundColor = ConsoleColor.Red; - Console.WriteLine($"Fail: {methodInfo.Name} ({stopwatch.ElapsedMilliseconds}ms)"); - - StringBuilder stringBuilder = new StringBuilder("\t"); - - // First exception is telling just that invoking method failed - exception = exception.InnerException; - string stackTrace = exception.StackTrace; - - while (exception != null) - { - stringBuilder.AppendLine(exception.Message); - - exception = exception.InnerException; - } - - stringBuilder.AppendLine(stackTrace); - - stringBuilder.Replace(Environment.NewLine, Environment.NewLine + '\t'); - Console.WriteLine(stringBuilder.ToString()); - } - } - - Console.ForegroundColor = ConsoleColor.White; - Console.Write(Environment.NewLine + "Press any key to exit . . ."); - Console.ReadKey(true); - } - } -} diff --git a/NotifyPropertyChangedBase.sln b/NotifyPropertyChangedBase.sln index 0681019..8fa356c 100644 --- a/NotifyPropertyChangedBase.sln +++ b/NotifyPropertyChangedBase.sln @@ -18,8 +18,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NotifyPropertyChangedBase", EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NotifyPropertyChangedBase.Tests", "NotifyPropertyChangedBase.Tests\NotifyPropertyChangedBase.Tests.csproj", "{22A1B2AF-E249-4B07-91DC-5C3E80D0567B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotifyPropertyChangedBase.Tests.Host", "NotifyPropertyChangedBase.Tests.Host\NotifyPropertyChangedBase.Tests.Host.csproj", "{BAFF5E97-BE13-4BA2-9C91-B7FFEE761392}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -34,10 +32,6 @@ Global {22A1B2AF-E249-4B07-91DC-5C3E80D0567B}.Debug|Any CPU.Build.0 = Debug|Any CPU {22A1B2AF-E249-4B07-91DC-5C3E80D0567B}.Release|Any CPU.ActiveCfg = Release|Any CPU {22A1B2AF-E249-4B07-91DC-5C3E80D0567B}.Release|Any CPU.Build.0 = Release|Any CPU - {BAFF5E97-BE13-4BA2-9C91-B7FFEE761392}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BAFF5E97-BE13-4BA2-9C91-B7FFEE761392}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BAFF5E97-BE13-4BA2-9C91-B7FFEE761392}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BAFF5E97-BE13-4BA2-9C91-B7FFEE761392}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Run-UnitTests.ps1 b/Run-UnitTests.ps1 new file mode 100644 index 0000000..57ecb67 --- /dev/null +++ b/Run-UnitTests.ps1 @@ -0,0 +1,4 @@ +do { + dotnet test "./NotifyPropertyChangedBase.Tests/NotifyPropertyChangedBase.Tests.csproj" --no-build + Write-Host "`nPress R to repeat or any other key to exit . . ." +} while ([System.Console]::ReadKey($true).Key -eq [System.ConsoleKey]::R) \ No newline at end of file From 0a0136196ea38ae840efc36dd74804278f645ce5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Fri, 8 Sep 2017 13:58:58 +0200 Subject: [PATCH 104/118] Minor changes [skip ci] --- NotifyPropertyChangedBase.Tests/Wrapper.cs | 10 +++++----- NotifyPropertyChangedBase.sln | 1 + NotifyPropertyChangedBase/NotifyPropertyChanged.cs | 8 ++++---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/NotifyPropertyChangedBase.Tests/Wrapper.cs b/NotifyPropertyChangedBase.Tests/Wrapper.cs index 7e4b052..177ebad 100644 --- a/NotifyPropertyChangedBase.Tests/Wrapper.cs +++ b/NotifyPropertyChangedBase.Tests/Wrapper.cs @@ -29,16 +29,16 @@ namespace NotifyPropertyChangedBase.Tests { internal sealed class Wrapper : NotifyPropertyChanged { - internal new bool IsPropertyChangedCallbackInvokingEnabled - { - get { return base.IsPropertyChangedCallbackInvokingEnabled; } - set { base.IsPropertyChangedCallbackInvokingEnabled = value; } - } internal new bool IsPropertyChangedEventInvokingEnabled { get { return base.IsPropertyChangedEventInvokingEnabled; } set { base.IsPropertyChangedEventInvokingEnabled = value; } } + internal new bool IsPropertyChangedCallbackInvokingEnabled + { + get { return base.IsPropertyChangedCallbackInvokingEnabled; } + set { base.IsPropertyChangedCallbackInvokingEnabled = value; } + } internal new void RegisterProperty(string name, Type type, object defaultValue) { diff --git a/NotifyPropertyChangedBase.sln b/NotifyPropertyChangedBase.sln index 8fa356c..fc660fe 100644 --- a/NotifyPropertyChangedBase.sln +++ b/NotifyPropertyChangedBase.sln @@ -11,6 +11,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution appveyor.yml = appveyor.yml LICENSE.md = LICENSE.md README.md = README.md + Run-UnitTests.ps1 = Run-UnitTests.ps1 SharedAssemblyInfo.cs = SharedAssemblyInfo.cs EndProjectSection EndProject diff --git a/NotifyPropertyChangedBase/NotifyPropertyChanged.cs b/NotifyPropertyChangedBase/NotifyPropertyChanged.cs index a4cacc7..7073a74 100644 --- a/NotifyPropertyChangedBase/NotifyPropertyChanged.cs +++ b/NotifyPropertyChangedBase/NotifyPropertyChanged.cs @@ -40,17 +40,17 @@ public abstract class NotifyPropertyChanged : INotifyPropertyChanged private readonly Dictionary backingStore = new Dictionary(); /// - /// Gets or sets the value indicating whether the specific for each property should be invoked + /// Gets or sets the value indicating whether the event should be invoked /// from the and methods /// when a property changes. The default value is true. /// - protected bool IsPropertyChangedCallbackInvokingEnabled { get; set; } + protected bool IsPropertyChangedEventInvokingEnabled { get; set; } /// - /// Gets or sets the value indicating whether the event should be invoked + /// Gets or sets the value indicating whether the specific for each property should be invoked /// from the and methods /// when a property changes. The default value is true. /// - protected bool IsPropertyChangedEventInvokingEnabled { get; set; } + protected bool IsPropertyChangedCallbackInvokingEnabled { get; set; } /// /// Implementation of the event. Occurs when a property value changes. From 196b6bf81e718bfaf3a114ee84648682563ac81a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Fri, 8 Sep 2017 16:20:43 +0200 Subject: [PATCH 105/118] There're more of 'em [skip deployment] --- NotifyPropertyChangedBase.Tests/Tests.cs | 62 ++++++++++++++++++------ Run-UnitTests.ps1 | 2 +- 2 files changed, 47 insertions(+), 17 deletions(-) diff --git a/NotifyPropertyChangedBase.Tests/Tests.cs b/NotifyPropertyChangedBase.Tests/Tests.cs index 73d5ab0..8a0ab54 100644 --- a/NotifyPropertyChangedBase.Tests/Tests.cs +++ b/NotifyPropertyChangedBase.Tests/Tests.cs @@ -57,8 +57,8 @@ public sealed class Tests public void ConstructorTest() { Wrapper w = new Wrapper(); - Assert.IsTrue(w.IsPropertyChangedCallbackInvokingEnabled); Assert.IsTrue(w.IsPropertyChangedEventInvokingEnabled); + Assert.IsTrue(w.IsPropertyChangedCallbackInvokingEnabled); } [TestMethod] @@ -111,15 +111,27 @@ public void WorkingWithPropertiesTest() Assert.ThrowsException(() => w.ForceSetValue(null, "NotRegisteredProperty")); bool propertyChangedEventInvoked = false; + bool propertyChangedCallbackInvoked = false; string propertyName = null; + object oldValue = null; + object value = null; w.PropertyChanged += (sender, e) => { - Assert.AreEqual(propertyName, e.PropertyName); Assert.AreEqual(w, sender); + Assert.AreEqual(propertyName, e.PropertyName); propertyChangedEventInvoked = true; }; + PropertyChangedCallbackHandler propertyChangedCallback = (sender, e) => + { + Assert.AreEqual(w, sender); + Assert.IsFalse(e.Handled); + Assert.AreEqual(oldValue, e.OldValue); + Assert.AreEqual(value, e.NewValue); + + propertyChangedCallbackInvoked = true; + }; foreach (TypeData typeData in typeDataCollection) { @@ -142,36 +154,44 @@ public void WorkingWithPropertiesTest() AllThrows(typeData.InvalidValues, invalidValue => w.SetValue(invalidValue, propertyName)); AllThrows(typeData.InvalidValues, invalidValue => w.ForceSetValue(invalidValue, propertyName)); - void Test(bool force, bool isPropertyChangedEventInvokingEnabled, object defaultValue) + void Test(bool force, bool eventsEnabled, object defaultValue) { - w.IsPropertyChangedEventInvokingEnabled = isPropertyChangedEventInvokingEnabled; + w.IsPropertyChangedEventInvokingEnabled = eventsEnabled; + w.IsPropertyChangedCallbackInvokingEnabled = eventsEnabled; - object value = defaultValue; + oldValue = null; + value = defaultValue; // Default value - w.RegisterProperty(propertyName, typeData.Type, value); + w.RegisterProperty(propertyName, typeData.Type, value, propertyChangedCallback); Assert.AreEqual(value, w.GetValue(propertyName)); - CheckPropertyChangedInvoked(false); + CheckEventsInvoked(false); CheckNoChangeSet(); // Changing value but not assigning it to property - value = typeData.GetNewValue(value); + SetValue(typeData.GetNewValue(value)); // Probably not needed but I like this ( ͡° ͜ʖ ͡°) Assert.AreNotEqual(value, w.GetValue(propertyName)); - CheckPropertyChangedInvoked(false); + CheckEventsInvoked(false); // Assigning changed value - SetAndTest(isPropertyChangedEventInvokingEnabled); + SetAndTest(eventsEnabled); CheckNoChangeSet(); // Assigning default value e.g. null etc. - value = defaultValue; - SetAndTest(isPropertyChangedEventInvokingEnabled); + SetValue(defaultValue); + SetAndTest(eventsEnabled); CheckNoChangeSet(); + void SetValue(object newValue) + { + oldValue = value; + value = newValue; + } + void SetAndTest(bool shouldInvokePropertyChangedEvent) { if (force) @@ -184,19 +204,29 @@ void SetAndTest(bool shouldInvokePropertyChangedEvent) } Assert.AreEqual(value, w.GetValue(propertyName)); - CheckPropertyChangedInvoked(shouldInvokePropertyChangedEvent); + CheckEventsInvoked(shouldInvokePropertyChangedEvent); } void CheckNoChangeSet() { - // No change in value - SetAndTest(force && isPropertyChangedEventInvokingEnabled); + if (force) + { + // Has to be set to the same + // When force == true, it will call callback + oldValue = value; + } + + // No change in value - invoking events only when forced + SetAndTest(force && eventsEnabled); } - void CheckPropertyChangedInvoked(bool expectedValue) + void CheckEventsInvoked(bool expectedValue) { Assert.AreEqual(expectedValue, propertyChangedEventInvoked); propertyChangedEventInvoked = false; + + Assert.AreEqual(expectedValue, propertyChangedCallbackInvoked); + propertyChangedCallbackInvoked = false; } } } diff --git a/Run-UnitTests.ps1 b/Run-UnitTests.ps1 index 57ecb67..ebed4f7 100644 --- a/Run-UnitTests.ps1 +++ b/Run-UnitTests.ps1 @@ -1,4 +1,4 @@ do { dotnet test "./NotifyPropertyChangedBase.Tests/NotifyPropertyChangedBase.Tests.csproj" --no-build - Write-Host "`nPress R to repeat or any other key to exit . . ." + Write-Host "`nPress R to run again or any other key to exit . . ." } while ([System.Console]::ReadKey($true).Key -eq [System.ConsoleKey]::R) \ No newline at end of file From 92e83c3e5969730083864f3e64d03008eb1ed5c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Fri, 8 Sep 2017 19:18:28 +0200 Subject: [PATCH 106/118] Stage 41685316531 and its done. 100% code coverage! lol --- NotifyPropertyChangedBase.Tests/Tests.cs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/NotifyPropertyChangedBase.Tests/Tests.cs b/NotifyPropertyChangedBase.Tests/Tests.cs index 8a0ab54..a838b96 100644 --- a/NotifyPropertyChangedBase.Tests/Tests.cs +++ b/NotifyPropertyChangedBase.Tests/Tests.cs @@ -112,6 +112,7 @@ public void WorkingWithPropertiesTest() bool propertyChangedEventInvoked = false; bool propertyChangedCallbackInvoked = false; + bool propertyChangedCallbackRegistered = true; string propertyName = null; object oldValue = null; object value = null; @@ -158,6 +159,7 @@ void Test(bool force, bool eventsEnabled, object defaultValue) { w.IsPropertyChangedEventInvokingEnabled = eventsEnabled; w.IsPropertyChangedCallbackInvokingEnabled = eventsEnabled; + propertyChangedCallbackRegistered = true; oldValue = null; value = defaultValue; @@ -169,6 +171,9 @@ void Test(bool force, bool eventsEnabled, object defaultValue) CheckNoChangeSet(); + propertyChangedCallbackRegistered = false; + w.UnregisterPropertyChangedCallback(propertyName, propertyChangedCallback); + // Changing value but not assigning it to property SetValue(typeData.GetNewValue(value)); // Probably not needed but I like this ( ͡° ͜ʖ ͡°) @@ -180,6 +185,9 @@ void Test(bool force, bool eventsEnabled, object defaultValue) CheckNoChangeSet(); + w.RegisterPropertyChangedCallback(propertyName, propertyChangedCallback); + propertyChangedCallbackRegistered = true; + // Assigning default value e.g. null etc. SetValue(defaultValue); SetAndTest(eventsEnabled); @@ -192,7 +200,7 @@ void SetValue(object newValue) value = newValue; } - void SetAndTest(bool shouldInvokePropertyChangedEvent) + void SetAndTest(bool shouldInvokeEvents) { if (force) { @@ -204,7 +212,7 @@ void SetAndTest(bool shouldInvokePropertyChangedEvent) } Assert.AreEqual(value, w.GetValue(propertyName)); - CheckEventsInvoked(shouldInvokePropertyChangedEvent); + CheckEventsInvoked(shouldInvokeEvents); } void CheckNoChangeSet() @@ -220,12 +228,12 @@ void CheckNoChangeSet() SetAndTest(force && eventsEnabled); } - void CheckEventsInvoked(bool expectedValue) + void CheckEventsInvoked(bool shouldInvokeEvents) { - Assert.AreEqual(expectedValue, propertyChangedEventInvoked); + Assert.AreEqual(shouldInvokeEvents, propertyChangedEventInvoked); propertyChangedEventInvoked = false; - Assert.AreEqual(expectedValue, propertyChangedCallbackInvoked); + Assert.AreEqual(shouldInvokeEvents && propertyChangedCallbackRegistered, propertyChangedCallbackInvoked); propertyChangedCallbackInvoked = false; } } From a1f31fbb705873d76ff40c0c6defd8e87e76e27f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Sun, 10 Sep 2017 12:16:54 +0200 Subject: [PATCH 107/118] Minor changes [skip ci] --- NotifyPropertyChangedBase/Helpers.cs | 6 ++---- NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/NotifyPropertyChangedBase/Helpers.cs b/NotifyPropertyChangedBase/Helpers.cs index 5c4ea59..caecae1 100644 --- a/NotifyPropertyChangedBase/Helpers.cs +++ b/NotifyPropertyChangedBase/Helpers.cs @@ -47,8 +47,7 @@ internal static void ValidateStringNotNullOrWhiteSpace(string str, string parame throw new ArgumentException("Value cannot be white space or null.", parameterName); } } - - // Make changes in the NotifyPropertyChangedBase.Uap.rd file if you change something with the 'type' parameter + internal static bool GetIsValueType(this Type type) { #if !NET_40 @@ -57,8 +56,7 @@ internal static bool GetIsValueType(this Type type) return type.IsValueType; #endif } - - // Make changes in the NotifyPropertyChangedBase.Uap.rd file if you change something with the 'secondType' parameter + internal static bool GetIsAssignableFrom(this Type type, Type secondType) { #if !NET_40 diff --git a/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj b/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj index b7161a6..61264e7 100644 --- a/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj +++ b/NotifyPropertyChangedBase/NotifyPropertyChangedBase.csproj @@ -13,7 +13,7 @@ 1.0.0.0 1.0.0 1.0.0.0 - MVVM Binding Bindings Helper Helpers + INotifyPropertyChanged NotifyPropertyChanged MVVM Model View ViewModel Model-View-ViewModel Binding Bindings Helper Helpers https://github.com/bramborman/NotifyPropertyChangedBase/blob/master/LICENSE.md https://github.com/bramborman/NotifyPropertyChangedBase https://github.com/bramborman/NotifyPropertyChangedBase From 7753f6f706a53720e853912d1d6be4d2a37223c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Sun, 10 Sep 2017 13:23:59 +0200 Subject: [PATCH 108/118] Improved unit tests [skip deployment] --- NotifyPropertyChangedBase.Tests/Tests.cs | 26 +++++++++++++++--------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/NotifyPropertyChangedBase.Tests/Tests.cs b/NotifyPropertyChangedBase.Tests/Tests.cs index a838b96..6835a13 100644 --- a/NotifyPropertyChangedBase.Tests/Tests.cs +++ b/NotifyPropertyChangedBase.Tests/Tests.cs @@ -109,9 +109,9 @@ public void WorkingWithPropertiesTest() Assert.ThrowsException(() => w.GetValue("NotRegisteredProperty")); Assert.ThrowsException(() => w.SetValue(null, "NotRegisteredProperty")); Assert.ThrowsException(() => w.ForceSetValue(null, "NotRegisteredProperty")); - - bool propertyChangedEventInvoked = false; - bool propertyChangedCallbackInvoked = false; + + int propertyChangedEventInvokeCount = 0; + int propertyChangedCallbackInvokeCount = 0; bool propertyChangedCallbackRegistered = true; string propertyName = null; object oldValue = null; @@ -122,7 +122,7 @@ public void WorkingWithPropertiesTest() Assert.AreEqual(w, sender); Assert.AreEqual(propertyName, e.PropertyName); - propertyChangedEventInvoked = true; + propertyChangedEventInvokeCount++; }; PropertyChangedCallbackHandler propertyChangedCallback = (sender, e) => { @@ -131,7 +131,7 @@ public void WorkingWithPropertiesTest() Assert.AreEqual(oldValue, e.OldValue); Assert.AreEqual(value, e.NewValue); - propertyChangedCallbackInvoked = true; + propertyChangedCallbackInvokeCount++; }; foreach (TypeData typeData in typeDataCollection) @@ -230,11 +230,17 @@ void CheckNoChangeSet() void CheckEventsInvoked(bool shouldInvokeEvents) { - Assert.AreEqual(shouldInvokeEvents, propertyChangedEventInvoked); - propertyChangedEventInvoked = false; - - Assert.AreEqual(shouldInvokeEvents && propertyChangedCallbackRegistered, propertyChangedCallbackInvoked); - propertyChangedCallbackInvoked = false; + if (shouldInvokeEvents) + { + Assert.AreEqual(1, propertyChangedEventInvokeCount); + propertyChangedEventInvokeCount = 0; + + if (propertyChangedCallbackRegistered) + { + Assert.AreEqual(1, propertyChangedCallbackInvokeCount); + propertyChangedCallbackInvokeCount = 0; + } + } } } } From 207c6daea2791567497972b453d3d1e62aea63c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Sun, 10 Sep 2017 14:55:29 +0200 Subject: [PATCH 109/118] Improved summaries - closes #27 --- .../NotifyPropertyChanged.cs | 46 +++++++++---------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/NotifyPropertyChangedBase/NotifyPropertyChanged.cs b/NotifyPropertyChangedBase/NotifyPropertyChanged.cs index 7073a74..7d55d2d 100644 --- a/NotifyPropertyChangedBase/NotifyPropertyChanged.cs +++ b/NotifyPropertyChangedBase/NotifyPropertyChanged.cs @@ -33,7 +33,7 @@ namespace NotifyPropertyChangedBase { /// - /// Abstract class implementing the interface. + /// Abstract base class implementing the interface. /// public abstract class NotifyPropertyChanged : INotifyPropertyChanged { @@ -41,13 +41,11 @@ public abstract class NotifyPropertyChanged : INotifyPropertyChanged /// /// Gets or sets the value indicating whether the event should be invoked - /// from the and methods /// when a property changes. The default value is true. /// protected bool IsPropertyChangedEventInvokingEnabled { get; set; } /// - /// Gets or sets the value indicating whether the specific for each property should be invoked - /// from the and methods + /// Gets or sets the value indicating whether registered s should be invoked /// when a property changes. The default value is true. /// protected bool IsPropertyChangedCallbackInvokingEnabled { get; set; } @@ -67,7 +65,7 @@ protected NotifyPropertyChanged() } /// - /// Registers a new property for the actual instance of . + /// Registers a new property in the actual instance of . /// /// Name of the registered property. /// Type of the registered property. @@ -77,10 +75,10 @@ protected NotifyPropertyChanged() /// Parameter is null or white space. /// /// - /// Value of cannot be assigned to a property of type in . + /// Value of cannot be assigned to a property of type specified in the parameter. /// /// - /// Instance already contains registered property named as specified in parameter . + /// Instance already contains a registered property named the same as specified in parameter . /// /// /// Parameter is null. @@ -90,7 +88,7 @@ protected void RegisterProperty(string name, Type type, object defaultValue) } /// - /// Registers a new property for the actual instance of . + /// Registers a new property in the actual instance of . /// /// Name of the registered property. /// Type of the registered property. @@ -101,10 +99,10 @@ protected void RegisterProperty(string name, Type type, object defaultValue) /// Parameter is null or white space. /// /// - /// Value of cannot be assigned to a property of type in . + /// Value of cannot be assigned to a property of type specified in the parameter. /// /// - /// Instance already contains registered property named as specified in parameter . + /// Instance already contains a registered property named the same as specified in parameter . /// /// /// Parameter is null. @@ -123,7 +121,7 @@ protected void RegisterProperty(string name, Type type, object defaultValue, Pro } /// - /// Registers the as a to a registered property. + /// Registers the to be invoked when the property with the specified name changes. /// /// Name of the property. /// to be registered. @@ -132,7 +130,7 @@ protected void RegisterProperty(string name, Type type, object defaultValue, Pro /// Parameter is null or white space. /// /// - /// Actual instance does not contain registered property with name specified in the parameter. + /// Actual instance does not contain registered property with the specified name. /// /// /// Parameter is null. @@ -145,7 +143,7 @@ protected void RegisterPropertyChangedCallback(string propertyName, PropertyChan } /// - /// Unregisters the from a registered property. + /// Unregisters the so it will NOT be invoked when the property with the specified name changes. /// /// Name of the property. /// to be unregistered. @@ -154,7 +152,7 @@ protected void RegisterPropertyChangedCallback(string propertyName, PropertyChan /// Parameter is null or white space. /// /// - /// Actual instance does not contain registered property with name specified in the parameter. + /// Actual instance does not contain registered property with the specified name. /// /// /// Parameter is null. @@ -176,7 +174,7 @@ protected void UnregisterPropertyChangedCallback(string propertyName, PropertyCh /// Parameter is null or white space. /// /// - /// Actual instance does not contain registered property with name specified in the parameter. + /// Actual instance does not contain registered property with the specified name. /// /// #if NET_40 @@ -191,20 +189,19 @@ protected object GetValue([CallerMemberName]string propertyName = null) /// /// Sets new value to a registered property even if it is equal to its current value and invokes the /// for the property if specified before and if the value of is true - /// and also invokes the event - /// if value of is true. + /// and also invokes the event if value of is true. /// /// New value for the property. /// Name of the property. /// /// - /// Value of the parameter cannot be assigned to the type of property with name specified in the parameter. + /// Value cannot be assigned to the property with the specified name because of its type. /// /// /// Parameter is null or white space. /// /// - /// Actual instance does not contain registered property with name specified in the parameter. + /// Actual instance does not contain registered property with the specified name. /// /// #if NET_40 @@ -219,20 +216,19 @@ protected void ForceSetValue(object value, [CallerMemberName]string propertyName /// /// Sets a new value to a registered property if it's not equal to its current value and invokes the /// for the property if specified before and if the value of is true - /// and also invokes the event - /// if value of is true. + /// and also invokes the event if value of is true. /// /// New value for the property. /// Name of the property. /// /// - /// Value of the parameter cannot be assigned to the type of property with name specified in the parameter. + /// Value cannot be assigned to the property with the specified name because of its type. /// /// /// Parameter is null or white space. /// /// - /// Actual instance does not contain registered property with name specified in the parameter. + /// Actual instance does not contain registered property with the specified name. /// /// #if NET_40 @@ -339,9 +335,9 @@ internal void InvokePropertyChangedCallback(NotifyPropertyChanged sender, Proper } /// - /// Represents the callback that is invoked when a registered property value of the class changes before the event. + /// Represents the callback that is invoked when a property registered in the class changes. /// - /// Instance of the class that invoked this callback. + /// Object that invoked this callback. /// Callback data containing info about the changed property. public delegate void PropertyChangedCallbackHandler(NotifyPropertyChanged sender, PropertyChangedCallbackArgs e); From 8aa859f97a0af30c1c40d8b62fc8dde472c85f16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Sun, 10 Sep 2017 21:16:55 +0200 Subject: [PATCH 110/118] Improving readme - working on #18 --- README.md | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index e17be51..79c38ff 100644 --- a/README.md +++ b/README.md @@ -7,26 +7,37 @@ NotifyPropertyChangedBase provides a simple to use yet powerful base class `NotifyPropertyChanged` that implements the `INotifyPropertyChanged` interface. Whether you're writing UWP, Xamarin, WPF or any other app, it will help you work with data. +This is an open-source project so feel free to send a pull request or open an issue. + ### Pre-release [![MyGet](https://img.shields.io/myget/bramborman/vpre/NotifyPropertyChangedBase.svg)][MyGet] [![Build status](https://ci.appveyor.com/api/projects/status/jc9gcr4gldjr8nq6/branch/dev?svg=true)](https://ci.appveyor.com/project/bramborman/notifypropertychangedbase/branch/dev) [![Code coverage](https://codecov.io/gh/bramborman/NotifyPropertyChangedBase/branch/dev/graph/badge.svg)](https://codecov.io/gh/bramborman/NotifyPropertyChangedBase/branch/dev) -If you want to get updates more frequently and you don't mind the possibility of bugs, you can download the pre-release version of NotifyPropertyChangedBase from MyGet.org right [**here**][MyGet]. +If you want to get updates more frequently or test bugfixes and new features before they go into production and you don't mind the possibility of new bugs, you can use the pre-release version of NotifyPropertyChangedBase from MyGet.org. + +[**Download it here**][MyGet] [MyGet]: https://www.myget.org/feed/bramborman/package/nuget/NotifyPropertyChangedBase -## How-to -NotifyPropertyChangedBase library consists of one namespace `NotifyPropertyChangedBase` which contains one class - `NotifyPropertyChanged`. This class implements the `INotifyPropertyChanged` interface and has some additional methods to help you use it. It's usage is similar to the usage of `DependencyObject` however it does not inherit from it nor it can be used only on UI thread - you can access it from any thread you want. +## How to use it? +NotifyPropertyChangedBase library helps you use `INotifyPropertyChanged` interface without needing to write your own logic. The one and only thing you need to use is an abstract class `NotifyPropertyChanged`. So instead of worrying about backing stores - variables that hold data of properties - about compairing each property you will register your property and our class will do the rest. -Here is a simple class that inherits from `NotifyPropertyChanged` class. -To be able to use any property, you have to register it using the `RegisterProperty` method. It has three required parameters: +It's usage is similar to usage of `DependencyObject`, that you may be familiar with from UWP or WPF, however it does **not** inherit from it nor it can be used only on UI thread - **you can access it from any thread you want**. + +As I said before, to be able to use any property (and benefit from the advantages of NotifyPropertyChangedBase), you have to register it using the `RegisterProperty` method. It has three required parameters and one overload accepting fourth parameter: - name of the property (using it you'll be accessing its value and doing all the work with the property) - type of the property - default value of the property - - (optional) property changed callback - a method that will be invoked when given property changes providing you info about the previous value of the property and it's new - current value + - (optional) property changed callback - a method that will be invoked after given property changes, but before the `PropertyChanged` event is invoked, providing you info about the previous value of the property and it's new - current value + +> Please note that unlike `DependencyProperty.Register` the `RegisterProperty` method here does **not** return anything and you don't have to store anything. You're accessing the property only using it's name. -> Please note that unlike `DependencyProperty.Register` the `RegisterProperty` method here does not return anything and you don't have to store anything. You're accessing the property only using it's name. +Here's a simple class using some advantages of NotifyPropertyChangedBase. It has two properties, `Bar` and `Greeting`. Both are backed by `NotifyPropertyChanged` class so anytime their value is changed, the `PropertyChanged` event is automatically invoked. Then you can get their value by calling `GetValue` and set it using `SetValue` and `ForceSetValue` methods (we'll talk about their difference later). + +All these methods have an argument `propertyName` specifying which property are you working with. But you can fully omit these as the compiler will pass the name of property/method from which these methods are called from because the argument has the [`CallerMemberNameAttribute`](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.callermembernameattribute) (does **not** apply to .NET 4.0 where the attribute is **not** available). + +>I'm using the [`nameof`](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/nameof) keyword but you can of course use just a string i.e. `"Bar"` etc. when working with properties. using NotifyPropertyChangedBase; @@ -55,10 +66,9 @@ To be able to use any property, you have to register it using the `RegisterPrope } } -### Working with properties -In the first example we've been using the simpliest way of working with properties - `GetValue` and `SetValue` methods that works without/with one parameter and you don't have to specify the name of the property you're working with. That's because these methods, similarly to the `ForceSetValue` method that we'll be talking about later uses [`CallerMemberNameAttribute`](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.callermembernameattribute) that does it for you. But you can also specify the name of the property you want to work with manually, for instance, `GetValue("Bar")` will return the actual value of the property `Bar`. +This is just a simple example. Of course you could call `GetValue`, `SetValue` and `ForceSetValue` anywhere in the code, not only in the body of related properties but using `Bar = 5;` over `SetValue(5, nameof(Bar));` and so on seems much simpler to me. -`GetValue` and `SetValue` methods does simply what their name implies - get or set the value of a property with the given name but there's another similar method - `ForceSetValue`. The difference between `SetValue` and `ForceSetValue` is that the latter always sets the new value to a property however `SetValue` checks whether the old value and the new one are the same using the `Equals` (you may want to [override it](https://docs.microsoft.com/en-us/dotnet/api/system.object.equals) to achieve the desired result on this check) and assigns the new value and tries to invoke the `PropertyChanged` event and `PropertyChangedCallback` only if the two values are not equal. +`GetValue` and `SetValue` methods does simply what their name implies - get or set the value of a property with the given name but there's another similar method - `ForceSetValue`. The difference between `SetValue` and `ForceSetValue` is that the latter always sets the new value to a property however `SetValue` checks whether the old value and the new one are the same using the `Equals` method (you may want to [override it](https://docs.microsoft.com/en-us/dotnet/api/system.object.equals) to achieve the desired result on this check). `SetValue` only assigns the new value and invokes the `PropertyChanged` event and `PropertyChangedCallback` only if the two values are **not** equal. ### Structure of the `NotifyPropertyChanged` class All the members of this class are `protected` - only derived classes can use them. @@ -73,3 +83,4 @@ All the members of this class are `protected` - only derived classes can use the protected void ForceSetValue(object value, [CallerMemberName]string propertyName = null) protected void SetValue(object value, [CallerMemberName]string propertyName = null) protected virtual void OnPropertyChanged([CallerMemberName]string propertyName = null) + From 5a6125bab44c45b9efcfc5a94be9401ac9b00617 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Sun, 10 Sep 2017 21:19:15 +0200 Subject: [PATCH 111/118] Testing something for #18 --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 79c38ff..7c2b9f5 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ All these methods have an argument `propertyName` specifying which property are >I'm using the [`nameof`](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/nameof) keyword but you can of course use just a string i.e. `"Bar"` etc. when working with properties. +```csharp using NotifyPropertyChangedBase; class Foo : NotifyPropertyChanged @@ -65,6 +66,7 @@ All these methods have an argument `propertyName` specifying which property are Console.WriteLine($"Value of Greeting changed from '{e.OldValue}' to '{e.NewValue}'"); } } +``` This is just a simple example. Of course you could call `GetValue`, `SetValue` and `ForceSetValue` anywhere in the code, not only in the body of related properties but using `Bar = 5;` over `SetValue(5, nameof(Bar));` and so on seems much simpler to me. From 07e4489a9a855870a1b91d62f22edef3a33d7015 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Sun, 10 Sep 2017 21:52:28 +0200 Subject: [PATCH 112/118] Improved readme for the sake of #18 --- README.md | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 7c2b9f5..5592ed8 100644 --- a/README.md +++ b/README.md @@ -21,11 +21,11 @@ If you want to get updates more frequently or test bugfixes and new features bef [MyGet]: https://www.myget.org/feed/bramborman/package/nuget/NotifyPropertyChangedBase ## How to use it? -NotifyPropertyChangedBase library helps you use `INotifyPropertyChanged` interface without needing to write your own logic. The one and only thing you need to use is an abstract class `NotifyPropertyChanged`. So instead of worrying about backing stores - variables that hold data of properties - about compairing each property you will register your property and our class will do the rest. +NotifyPropertyChangedBase library helps you use `INotifyPropertyChanged` interface without needing to write your own logic. The one and only thing you need to do is to make your models inherit from the abstract class `NotifyPropertyChanged`. So instead of worrying about backing stores - variables that hold data of properties - about compairing data or calling the `PropertyChanged` event you will register your property and this class will do the rest. -It's usage is similar to usage of `DependencyObject`, that you may be familiar with from UWP or WPF, however it does **not** inherit from it nor it can be used only on UI thread - **you can access it from any thread you want**. +It's usage is very similar to the usage of `DependencyObject`, that you may be familiar with from UWP or WPF, however it does **not** inherit from it nor it can be used only on UI thread - **you can access it from any thread you want**. -As I said before, to be able to use any property (and benefit from the advantages of NotifyPropertyChangedBase), you have to register it using the `RegisterProperty` method. It has three required parameters and one overload accepting fourth parameter: +As said before, to be able to benefit from the advantages of NotifyPropertyChangedBase, you have to register your property using the `RegisterProperty` method. It has three required parameters and one overload accepting fourth parameter: - name of the property (using it you'll be accessing its value and doing all the work with the property) - type of the property - default value of the property @@ -33,11 +33,12 @@ As I said before, to be able to use any property (and benefit from the advantage > Please note that unlike `DependencyProperty.Register` the `RegisterProperty` method here does **not** return anything and you don't have to store anything. You're accessing the property only using it's name. -Here's a simple class using some advantages of NotifyPropertyChangedBase. It has two properties, `Bar` and `Greeting`. Both are backed by `NotifyPropertyChanged` class so anytime their value is changed, the `PropertyChanged` event is automatically invoked. Then you can get their value by calling `GetValue` and set it using `SetValue` and `ForceSetValue` methods (we'll talk about their difference later). +To get and set values of registered properties you'll use `GetValue` and `SetValue` or `ForceSetValue` methods (we'll talk about their difference later). -All these methods have an argument `propertyName` specifying which property are you working with. But you can fully omit these as the compiler will pass the name of property/method from which these methods are called from because the argument has the [`CallerMemberNameAttribute`](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.callermembernameattribute) (does **not** apply to .NET 4.0 where the attribute is **not** available). +All these methods have an argument `propertyName` specifying which property are you working with but you can fully omit these as the compiler will pass the name of property/method from which these methods are called from because the argument has the [`CallerMemberNameAttribute`](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.callermembernameattribute) (does **not** apply to .NET 4.0 where the attribute is **not** available). `SetValue` and `ForceSetValue` have one another argument passed before the `propertyName` containing the value to be set to given property. ->I'm using the [`nameof`](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/nameof) keyword but you can of course use just a string i.e. `"Bar"` etc. when working with properties. +#### Example +Here's a simple class using some advantages of NotifyPropertyChangedBase. It has two properties, `Bar` and `Greeting`. Both are backed by `NotifyPropertyChanged` class so anytime their value is changed, the `PropertyChanged` event is automatically invoked. ```csharp using NotifyPropertyChangedBase; @@ -48,6 +49,10 @@ All these methods have an argument `propertyName` specifying which property are { get { return (int)GetValue(); } set { SetValue(value); } + + // These will do the same: + // get { return (int)GetValue(nameof(Bar)); } + // get { return (int)GetValue("Bar"); } } public string Greeting { @@ -58,6 +63,8 @@ All these methods have an argument `propertyName` specifying which property are public Foo() { RegisterProperty(nameof(Bar), typeof(int), 0); + // This will do the same: + // RegisterProperty("Bar", typeof(int), 0); RegisterProperty(nameof(Greeting), typeof(string), null, GreetingPropertyChanged); } @@ -68,13 +75,16 @@ All these methods have an argument `propertyName` specifying which property are } ``` -This is just a simple example. Of course you could call `GetValue`, `SetValue` and `ForceSetValue` anywhere in the code, not only in the body of related properties but using `Bar = 5;` over `SetValue(5, nameof(Bar));` and so on seems much simpler to me. +>I'm using the [`nameof`](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/nameof) keyword but you can of course use just a string i.e. `"Bar"` etc. when working with properties. + +This is just a simple example. Of course you can call `GetValue`, `SetValue` and `ForceSetValue` anywhere in the code, not only in the body of related properties but using `Bar = 5;` over `SetValue(5, nameof(Bar));` and so on seems much simpler to me. -`GetValue` and `SetValue` methods does simply what their name implies - get or set the value of a property with the given name but there's another similar method - `ForceSetValue`. The difference between `SetValue` and `ForceSetValue` is that the latter always sets the new value to a property however `SetValue` checks whether the old value and the new one are the same using the `Equals` method (you may want to [override it](https://docs.microsoft.com/en-us/dotnet/api/system.object.equals) to achieve the desired result on this check). `SetValue` only assigns the new value and invokes the `PropertyChanged` event and `PropertyChangedCallback` only if the two values are **not** equal. +`GetValue` and `SetValue` methods do simply what their names imply - gets or sets the value of a property with the given name but there's another similar method - `ForceSetValue`. The difference between `SetValue` and `ForceSetValue` is that the latter **always** sets the new value to a property and invokes the `PropertyChanged` event and registered callbacks, **no matter whether the value is different from the current one**. However `SetValue` checks whether the old value and the new one are differet using the `Equals` method (you may want to [override it](https://docs.microsoft.com/en-us/dotnet/api/system.object.equals) to achieve the desired result on this check). `SetValue` only assigns the new value and invokes the `PropertyChanged` event and registered callbacks only if the two values are **not** equal. ### Structure of the `NotifyPropertyChanged` class All the members of this class are `protected` - only derived classes can use them. +```csharp protected bool IsPropertyChangedCallbackInvokingEnabled { get; set; } protected bool IsPropertyChangedEventInvokingEnabled { get; set; } protected void RegisterProperty(string name, Type type, object defaultValue @@ -85,4 +95,5 @@ All the members of this class are `protected` - only derived classes can use the protected void ForceSetValue(object value, [CallerMemberName]string propertyName = null) protected void SetValue(object value, [CallerMemberName]string propertyName = null) protected virtual void OnPropertyChanged([CallerMemberName]string propertyName = null) +``` From f6391de415d414098a814b64ff29a09640fe8ce6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Sun, 10 Sep 2017 22:06:40 +0200 Subject: [PATCH 113/118] Got bored of these messages.... #18 --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 5592ed8..10fb204 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ As said before, to be able to benefit from the advantages of NotifyPropertyChang > Please note that unlike `DependencyProperty.Register` the `RegisterProperty` method here does **not** return anything and you don't have to store anything. You're accessing the property only using it's name. -To get and set values of registered properties you'll use `GetValue` and `SetValue` or `ForceSetValue` methods (we'll talk about their difference later). +To get and set values of registered properties you'll use `GetValue` and `SetValue` or `ForceSetValue`. The difference between `SetValue` and `ForceSetValue` is that the latter **always** sets the new value to a property and invokes the `PropertyChanged` event and registered callbacks, **no matter whether the value is different from the current one**. However `SetValue` checks whether the old value and the new one are differet using the `Equals` method (you may want to [override it](https://docs.microsoft.com/en-us/dotnet/api/system.object.equals) to achieve the desired result on this check). `SetValue` only assigns the new value and invokes the `PropertyChanged` event and registered callbacks only if the two values are **not** equal. All these methods have an argument `propertyName` specifying which property are you working with but you can fully omit these as the compiler will pass the name of property/method from which these methods are called from because the argument has the [`CallerMemberNameAttribute`](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.callermembernameattribute) (does **not** apply to .NET 4.0 where the attribute is **not** available). `SetValue` and `ForceSetValue` have one another argument passed before the `propertyName` containing the value to be set to given property. @@ -79,8 +79,6 @@ Here's a simple class using some advantages of NotifyPropertyChangedBase. It has This is just a simple example. Of course you can call `GetValue`, `SetValue` and `ForceSetValue` anywhere in the code, not only in the body of related properties but using `Bar = 5;` over `SetValue(5, nameof(Bar));` and so on seems much simpler to me. -`GetValue` and `SetValue` methods do simply what their names imply - gets or sets the value of a property with the given name but there's another similar method - `ForceSetValue`. The difference between `SetValue` and `ForceSetValue` is that the latter **always** sets the new value to a property and invokes the `PropertyChanged` event and registered callbacks, **no matter whether the value is different from the current one**. However `SetValue` checks whether the old value and the new one are differet using the `Equals` method (you may want to [override it](https://docs.microsoft.com/en-us/dotnet/api/system.object.equals) to achieve the desired result on this check). `SetValue` only assigns the new value and invokes the `PropertyChanged` event and registered callbacks only if the two values are **not** equal. - ### Structure of the `NotifyPropertyChanged` class All the members of this class are `protected` - only derived classes can use them. From 978c9519a60080b4f589b8146c7b331ae7f90628 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Sun, 10 Sep 2017 22:20:29 +0200 Subject: [PATCH 114/118] Closes #18 maybeee ^_^ --- README.md | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 10fb204..7049f5a 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,16 @@ To get and set values of registered properties you'll use `GetValue` and `SetVal All these methods have an argument `propertyName` specifying which property are you working with but you can fully omit these as the compiler will pass the name of property/method from which these methods are called from because the argument has the [`CallerMemberNameAttribute`](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.callermembernameattribute) (does **not** apply to .NET 4.0 where the attribute is **not** available). `SetValue` and `ForceSetValue` have one another argument passed before the `propertyName` containing the value to be set to given property. +There's also the `OnPropertyChanged` method, also having a `propertyName` argument with the same attribute, which you can use to invoke the `PropertyChanged` event manually. + +#### PropertyChangedCallback +Besides the `PropertyChanged` event that is invoked when any of the properties changes, NotifyPropertyChangedBase provides also the `PropertyChangedCallback` that is registered for each property independently. Registered callback is invoked **always** before the `PropertyChanged` event. + +There are two ways to register them - using overloaded `RegisterProperty` method which accepts a delegate of type `PropertyChangedCallback` as the last argument or using `RegisterPropertyChangedCallback`. The latter is designed to add another callback anytime after registering the property. You can also unregister a callback, registered using whichever of those two methods, using the `UnregisterPropertyChangedCallback` method. + +#### Having a control over everything +Using the `IsPropertyChangedEventInvokingEnabled` and `IsPropertyChangedCallbackInvokingEnabled` property you can enable/disable invocation of the `PropertyChanged` event and registered callbacks. Their default value is `true` but setting them to `false` will disable the respected events so even the `ForceSetValue` method will not be invoking them. + #### Example Here's a simple class using some advantages of NotifyPropertyChangedBase. It has two properties, `Bar` and `Greeting`. Both are backed by `NotifyPropertyChanged` class so anytime their value is changed, the `PropertyChanged` event is automatically invoked. @@ -62,9 +72,12 @@ Here's a simple class using some advantages of NotifyPropertyChangedBase. It has public Foo() { + // Property without a callback RegisterProperty(nameof(Bar), typeof(int), 0); // This will do the same: // RegisterProperty("Bar", typeof(int), 0); + + // Property with a callback RegisterProperty(nameof(Greeting), typeof(string), null, GreetingPropertyChanged); } @@ -79,19 +92,6 @@ Here's a simple class using some advantages of NotifyPropertyChangedBase. It has This is just a simple example. Of course you can call `GetValue`, `SetValue` and `ForceSetValue` anywhere in the code, not only in the body of related properties but using `Bar = 5;` over `SetValue(5, nameof(Bar));` and so on seems much simpler to me. -### Structure of the `NotifyPropertyChanged` class +#### Structure of the `NotifyPropertyChanged` class All the members of this class are `protected` - only derived classes can use them. - -```csharp - protected bool IsPropertyChangedCallbackInvokingEnabled { get; set; } - protected bool IsPropertyChangedEventInvokingEnabled { get; set; } - protected void RegisterProperty(string name, Type type, object defaultValue - protected void RegisterProperty(string name, Type type, object defaultValue, PropertyChangedCallbackHandler propertyChangedCallback) - protected void RegisterPropertyChangedCallback(string propertyName, PropertyChangedCallbackHandler propertyChangedCallback) - protected void UnregisterPropertyChangedCallback(string propertyName, PropertyChangedCallbackHandler propertyChangedCallback) - protected object GetValue([CallerMemberName]string propertyName = null) - protected void ForceSetValue(object value, [CallerMemberName]string propertyName = null) - protected void SetValue(object value, [CallerMemberName]string propertyName = null) - protected virtual void OnPropertyChanged([CallerMemberName]string propertyName = null) -``` From 3448bd0194847ec17e6352426140262ef27c3df3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Sun, 10 Sep 2017 22:34:07 +0200 Subject: [PATCH 115/118] =?UTF-8?q?#18=20=F0=9F=98=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 7049f5a..61abb8c 100644 --- a/README.md +++ b/README.md @@ -23,29 +23,31 @@ If you want to get updates more frequently or test bugfixes and new features bef ## How to use it? NotifyPropertyChangedBase library helps you use `INotifyPropertyChanged` interface without needing to write your own logic. The one and only thing you need to do is to make your models inherit from the abstract class `NotifyPropertyChanged`. So instead of worrying about backing stores - variables that hold data of properties - about compairing data or calling the `PropertyChanged` event you will register your property and this class will do the rest. -It's usage is very similar to the usage of `DependencyObject`, that you may be familiar with from UWP or WPF, however it does **not** inherit from it nor it can be used only on UI thread - **you can access it from any thread you want**. +It's usage is very similar to the usage of `DependencyObject`, that you may be familiar with from UWP or WPF, however it does **not** inherit from it nor it can only be used on the UI thread. **You can access it from any thread you want**. -As said before, to be able to benefit from the advantages of NotifyPropertyChangedBase, you have to register your property using the `RegisterProperty` method. It has three required parameters and one overload accepting fourth parameter: +To benefit from the advantages of NotifyPropertyChangedBase, you have to register your property using the `RegisterProperty` method. It has three required parameters and one overload accepting fourth parameter: - name of the property (using it you'll be accessing its value and doing all the work with the property) - type of the property - default value of the property - (optional) property changed callback - a method that will be invoked after given property changes, but before the `PropertyChanged` event is invoked, providing you info about the previous value of the property and it's new - current value -> Please note that unlike `DependencyProperty.Register` the `RegisterProperty` method here does **not** return anything and you don't have to store anything. You're accessing the property only using it's name. +> Please note that unlike `DependencyProperty.Register` the `RegisterProperty` method here does **not** return anything and you don't have to store anything. You're accessing the property using only it's name. -To get and set values of registered properties you'll use `GetValue` and `SetValue` or `ForceSetValue`. The difference between `SetValue` and `ForceSetValue` is that the latter **always** sets the new value to a property and invokes the `PropertyChanged` event and registered callbacks, **no matter whether the value is different from the current one**. However `SetValue` checks whether the old value and the new one are differet using the `Equals` method (you may want to [override it](https://docs.microsoft.com/en-us/dotnet/api/system.object.equals) to achieve the desired result on this check). `SetValue` only assigns the new value and invokes the `PropertyChanged` event and registered callbacks only if the two values are **not** equal. +To get and set values of registered properties you'll use `GetValue` and `SetValue` or `ForceSetValue`. The difference between `SetValue` and `ForceSetValue` is that the latter **always** sets the new value to a property and invokes the `PropertyChanged` event and registered callbacks, **no matter whether the value is different from the current one**. However `SetValue` checks whether the old value and the new one are differet using the `Equals` method (you may want to [override it](https://docs.microsoft.com/en-us/dotnet/api/system.object.equals) to achieve the desired result on this check). `SetValue` assigns the new value and invokes the `PropertyChanged` event and registered callbacks **only** if the two values are **not** equal. -All these methods have an argument `propertyName` specifying which property are you working with but you can fully omit these as the compiler will pass the name of property/method from which these methods are called from because the argument has the [`CallerMemberNameAttribute`](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.callermembernameattribute) (does **not** apply to .NET 4.0 where the attribute is **not** available). `SetValue` and `ForceSetValue` have one another argument passed before the `propertyName` containing the value to be set to given property. +All these methods have an argument `propertyName` specifying which property are you working with but you can fully omit these as the compiler will pass the name of property/method from which these methods are called from because the argument has the [`CallerMemberNameAttribute`](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.callermembernameattribute) (does **not** apply to .NET 4.0 where the attribute is **not** available). `SetValue` and `ForceSetValue` have one another argument that is passed before the `propertyName` containing the value to be set to given property. There's also the `OnPropertyChanged` method, also having a `propertyName` argument with the same attribute, which you can use to invoke the `PropertyChanged` event manually. #### PropertyChangedCallback -Besides the `PropertyChanged` event that is invoked when any of the properties changes, NotifyPropertyChangedBase provides also the `PropertyChangedCallback` that is registered for each property independently. Registered callback is invoked **always** before the `PropertyChanged` event. +Besides the `PropertyChanged` event that is invoked when any of the properties changes, NotifyPropertyChangedBase provides the `PropertyChangedCallback` that is registered for each property independently. Registered callbacks are invoked **always** before the `PropertyChanged` event. -There are two ways to register them - using overloaded `RegisterProperty` method which accepts a delegate of type `PropertyChangedCallback` as the last argument or using `RegisterPropertyChangedCallback`. The latter is designed to add another callback anytime after registering the property. You can also unregister a callback, registered using whichever of those two methods, using the `UnregisterPropertyChangedCallback` method. +There are two ways to register them - using overloaded `RegisterProperty` method which accepts a delegate of type `PropertyChangedCallback` as the last argument or using `RegisterPropertyChangedCallback`. The latter is designed to add another callback any time after registering the property. You can also unregister a callback, registered using whichever of those two methods, using the `UnregisterPropertyChangedCallback` method. #### Having a control over everything -Using the `IsPropertyChangedEventInvokingEnabled` and `IsPropertyChangedCallbackInvokingEnabled` property you can enable/disable invocation of the `PropertyChanged` event and registered callbacks. Their default value is `true` but setting them to `false` will disable the respected events so even the `ForceSetValue` method will not be invoking them. +Using the `IsPropertyChangedEventInvokingEnabled` and `IsPropertyChangedCallbackInvokingEnabled` properties you can enable/disable invocation of the `PropertyChanged` event or registered callbacks. Their default value is `true` but setting them to `false` will disable the respected events so even the `ForceSetValue` method will not be invoking them. + +> Setting `IsPropertyChangedCallbackInvokingEnabled` to `false` will **not** unregister already registered callbacks. #### Example Here's a simple class using some advantages of NotifyPropertyChangedBase. It has two properties, `Bar` and `Greeting`. Both are backed by `NotifyPropertyChanged` class so anytime their value is changed, the `PropertyChanged` event is automatically invoked. @@ -93,5 +95,4 @@ Here's a simple class using some advantages of NotifyPropertyChangedBase. It has This is just a simple example. Of course you can call `GetValue`, `SetValue` and `ForceSetValue` anywhere in the code, not only in the body of related properties but using `Bar = 5;` over `SetValue(5, nameof(Bar));` and so on seems much simpler to me. #### Structure of the `NotifyPropertyChanged` class -All the members of this class are `protected` - only derived classes can use them. - +All the members of this class (except of the `PropertyChanged` event) are `protected` so only derived classes can use them. From 7465064ad358a1bc2c184ffc0ae6290a30074b99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Sun, 10 Sep 2017 22:43:45 +0200 Subject: [PATCH 116/118] I may just got rid of this issue - closes #18 --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 61abb8c..cc6e133 100644 --- a/README.md +++ b/README.md @@ -44,8 +44,14 @@ Besides the `PropertyChanged` event that is invoked when any of the properties c There are two ways to register them - using overloaded `RegisterProperty` method which accepts a delegate of type `PropertyChangedCallback` as the last argument or using `RegisterPropertyChangedCallback`. The latter is designed to add another callback any time after registering the property. You can also unregister a callback, registered using whichever of those two methods, using the `UnregisterPropertyChangedCallback` method. +The handlers of these callbacks get two values as arguments - `sender` which holds the reference to the class that invoked that certain callback and `e` of type `PropertyChangedCallbackArgs` which has these properties: + + - `Handled` - indicates whether this certain callback has been handled. Default value is `false`. + - `OldValue` - holds the previous value of the related property. + - `NewValue` - holds the current value of the related property. + #### Having a control over everything -Using the `IsPropertyChangedEventInvokingEnabled` and `IsPropertyChangedCallbackInvokingEnabled` properties you can enable/disable invocation of the `PropertyChanged` event or registered callbacks. Their default value is `true` but setting them to `false` will disable the respected events so even the `ForceSetValue` method will not be invoking them. +Using the `IsPropertyChangedEventInvokingEnabled` and `IsPropertyChangedCallbackInvokingEnabled` properties you can enable/disable invocation of the `PropertyChanged` event or registered callbacks. Their default value is `true` but setting them to `false` will disable the respected events so even the `ForceSetValue` method will **not** be invoking them. > Setting `IsPropertyChangedCallbackInvokingEnabled` to `false` will **not** unregister already registered callbacks. @@ -92,7 +98,7 @@ Here's a simple class using some advantages of NotifyPropertyChangedBase. It has >I'm using the [`nameof`](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/nameof) keyword but you can of course use just a string i.e. `"Bar"` etc. when working with properties. -This is just a simple example. Of course you can call `GetValue`, `SetValue` and `ForceSetValue` anywhere in the code, not only in the body of related properties but using `Bar = 5;` over `SetValue(5, nameof(Bar));` and so on seems much simpler to me. +This is just a simple example. Of course you can call `GetValue`, `SetValue` and `ForceSetValue` anywhere in the code, **not** only in the body of related properties but using `Bar = 5;` over `SetValue(5, nameof(Bar));` and so on seems much simpler to me. #### Structure of the `NotifyPropertyChanged` class All the members of this class (except of the `PropertyChanged` event) are `protected` so only derived classes can use them. From 499818484816361f3261e794555fd4645f7793c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Sun, 10 Sep 2017 22:46:50 +0200 Subject: [PATCH 117/118] =?UTF-8?q?=F0=9F=98=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cc6e133..a102846 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ Besides the `PropertyChanged` event that is invoked when any of the properties c There are two ways to register them - using overloaded `RegisterProperty` method which accepts a delegate of type `PropertyChangedCallback` as the last argument or using `RegisterPropertyChangedCallback`. The latter is designed to add another callback any time after registering the property. You can also unregister a callback, registered using whichever of those two methods, using the `UnregisterPropertyChangedCallback` method. -The handlers of these callbacks get two values as arguments - `sender` which holds the reference to the class that invoked that certain callback and `e` of type `PropertyChangedCallbackArgs` which has these properties: +The handlers of these callbacks get two values as arguments - `sender` which holds the reference to the class that invoked that certain callback and `e` of type `PropertyChangedCallbackArgs` which has the following properties: - `Handled` - indicates whether this certain callback has been handled. Default value is `false`. - `OldValue` - holds the previous value of the related property. From ce10716b009b8ee9f3018cc712e0a3a308244fd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Dolinsk=C3=BD?= Date: Sun, 10 Sep 2017 23:02:08 +0200 Subject: [PATCH 118/118] One more time.. --- AppVeyor-Build.ps1 | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/AppVeyor-Build.ps1 b/AppVeyor-Build.ps1 index 9c54b9f..8afc9d3 100644 --- a/AppVeyor-Build.ps1 +++ b/AppVeyor-Build.ps1 @@ -1,4 +1,29 @@ -Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildScripts/master/Scripts/Set-BuildVersion.ps1" +# MIT License +# +# Copyright (c) 2017 Marian Dolinský +# +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation +# files (the "Software"), to deal in the Software without +# restriction, including without limitation the rights to use, +# copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following +# conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildScripts/master/Scripts/Set-BuildVersion.ps1" .\Set-BuildVersion.ps1 Start-FileDownload "https://raw.githubusercontent.com/bramborman/AppVeyorBuildScripts/master/Scripts/Set-PureBuildVersion.ps1"