diff --git a/EasyBackup.Test/EasyBackup.Test.csproj b/EasyBackup.Test/EasyBackup.Test.csproj new file mode 100644 index 0000000..b395ed0 --- /dev/null +++ b/EasyBackup.Test/EasyBackup.Test.csproj @@ -0,0 +1,96 @@ + + + + + + + + Debug + AnyCPU + {821F77E5-1333-4155-A987-D8CF0E847517} + Library + Properties + EasyBackup.Test + EasyBackup.Test + v4.8 + 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.2.2.10\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll + + + ..\packages\MSTest.TestFramework.2.2.10\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll + + + + + ..\packages\xunit.abstractions.2.0.3\lib\net35\xunit.abstractions.dll + + + ..\packages\xunit.assert.2.4.1\lib\netstandard1.1\xunit.assert.dll + + + ..\packages\xunit.extensibility.core.2.4.1\lib\net452\xunit.core.dll + + + ..\packages\xunit.extensibility.execution.2.4.1\lib\net452\xunit.execution.desktop.dll + + + + + + + + + + + + + + + + {a6f5ef7b-152c-4ffb-9fd3-f781b6ec78da} + EasyBackup + + + + + + + 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/EasyBackup.Test/Properties/AssemblyInfo.cs b/EasyBackup.Test/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..5dae54e --- /dev/null +++ b/EasyBackup.Test/Properties/AssemblyInfo.cs @@ -0,0 +1,20 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("EasyBackup.Test")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("EasyBackup.Test")] +[assembly: AssemblyCopyright("Copyright © 2024")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +[assembly: ComVisible(false)] + +[assembly: Guid("821f77e5-1333-4155-a987-d8cf0e847517")] + +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/EasyBackup.Test/TestHelpers/ChangeNotifierTests.cs b/EasyBackup.Test/TestHelpers/ChangeNotifierTests.cs new file mode 100644 index 0000000..1c6af0c --- /dev/null +++ b/EasyBackup.Test/TestHelpers/ChangeNotifierTests.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Xunit; + +namespace EasyBackup.Tests.TestHelpers +{ + public class ChangeNotifierTests + { + [Fact] + public void TestProperty_ShouldRaisePropertyChangedEvent() + { + // Arrange + var testChangeNotifier = new TestChangeNotifier(); + bool eventRaised = false; + + testChangeNotifier.PropertyChanged += (sender, args) => + { + if (args.PropertyName == nameof(TestChangeNotifier.TestProperty)) + { + eventRaised = true; + } + }; + + // Act + testChangeNotifier.TestProperty = "New Value"; + + // Assert + Assert.True(eventRaised); + } + } +} diff --git a/EasyBackup.Test/TestHelpers/TestChangeNotifier.cs b/EasyBackup.Test/TestHelpers/TestChangeNotifier.cs new file mode 100644 index 0000000..fb0576c --- /dev/null +++ b/EasyBackup.Test/TestHelpers/TestChangeNotifier.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using EasyBackup.Helpers; + +namespace EasyBackup.Tests.TestHelpers +{ + public class TestChangeNotifier : ChangeNotifier + { + private string _testProperty = ""; + public string TestProperty + { + get => _testProperty; + set + { + if (_testProperty != value) + { + _testProperty = value; + NotifyPropertyChanged(); + } + } + } + } +} \ No newline at end of file diff --git a/EasyBackup.Test/packages.config b/EasyBackup.Test/packages.config new file mode 100644 index 0000000..7073196 --- /dev/null +++ b/EasyBackup.Test/packages.config @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/EasyBackup.sln b/EasyBackup.sln index 49a3c04..802fe6d 100644 --- a/EasyBackup.sln +++ b/EasyBackup.sln @@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyBackup", "EasyBackup\Ea EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyBackupAvalonia", "EasyBackupAvalonia\EasyBackupAvalonia.csproj", "{A3A94941-B57C-40BC-82D6-23D1BCDDB0F6}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyBackup.Test", "EasyBackup.Test\EasyBackup.Test.csproj", "{821F77E5-1333-4155-A987-D8CF0E847517}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -21,6 +23,10 @@ Global {A3A94941-B57C-40BC-82D6-23D1BCDDB0F6}.Debug|Any CPU.Build.0 = Debug|Any CPU {A3A94941-B57C-40BC-82D6-23D1BCDDB0F6}.Release|Any CPU.ActiveCfg = Release|Any CPU {A3A94941-B57C-40BC-82D6-23D1BCDDB0F6}.Release|Any CPU.Build.0 = Release|Any CPU + {821F77E5-1333-4155-A987-D8CF0E847517}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {821F77E5-1333-4155-A987-D8CF0E847517}.Debug|Any CPU.Build.0 = Debug|Any CPU + {821F77E5-1333-4155-A987-D8CF0E847517}.Release|Any CPU.ActiveCfg = Release|Any CPU + {821F77E5-1333-4155-A987-D8CF0E847517}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/EasyBackup/Helpers/ChangeNotifier.cs b/EasyBackup/Helpers/ChangeNotifier.cs index 1e9e9c7..4fb54ae 100644 --- a/EasyBackup/Helpers/ChangeNotifier.cs +++ b/EasyBackup/Helpers/ChangeNotifier.cs @@ -9,7 +9,7 @@ namespace EasyBackup.Helpers { // https://docs.microsoft.com/en-us/dotnet/api/system.componentmodel.inotifypropertychanged?view=netframework-4.7.2 - class ChangeNotifier : INotifyPropertyChanged + public class ChangeNotifier : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; protected void NotifyPropertyChanged([CallerMemberName] string propertyName = "")