Skip to content

Commit

Permalink
Merge pull request #278 from Insire/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Insire authored Apr 16, 2023
2 parents fca0ff8 + 1f2e967 commit 417c1c2
Show file tree
Hide file tree
Showing 11 changed files with 49 additions and 21 deletions.
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "7.0.200",
"version": "7.0.203",
"rollForward": "disable"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="DynamicData" Version="7.12.11" />
<PackageReference Include="DynamicData" Version="7.13.5" />
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.39" />
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<PackageReference Include="NSubstitute.Analyzers.CSharp" Version="1.0.16" />

<PackageReference Include="nunit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.3.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.4.2" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,35 @@ public void Track_DoesWork(Func<IMessenger, ITestViewModel> factory)
Assert.AreEqual(tracker.CountChanges(viewModel), 1);
}

void ViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
void ViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
propertyChanged = true;
}
}

[Test]
[TestCaseSource(nameof(ViewModelFactories))]
public void Track_With_Reset_Values_DoesWork(Func<IMessenger, ITestViewModel> factory)
{
var propertyChanged = false;

var messenger = new WeakReferenceMessenger();
using (var tracker = new PropertyChangedMessageTracker(messenger))
{
var viewModel = factory(messenger);
viewModel.PropertyChanged += ViewModel_PropertyChanged;
tracker.Track<ITestViewModel, string>(viewModel);

viewModel.Property = string.Empty;
viewModel.Property = null;

Assert.IsTrue(propertyChanged);
Assert.IsFalse(tracker.HasChanges());
Assert.IsFalse(tracker.HasChanges(viewModel));
Assert.AreEqual(tracker.CountChanges(viewModel), 0);
}

void ViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
propertyChanged = true;
}
Expand Down Expand Up @@ -140,7 +168,7 @@ public void StopTracking_DoesWork(Func<IMessenger, ITestViewModel> factory)
Assert.AreEqual(tracker.CountChanges(viewModel), 0);
}

void ViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
void ViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
propertyChanged = true;
}
Expand Down Expand Up @@ -178,7 +206,7 @@ public void StopAllTracking_DoesWork(Func<IMessenger, ITestViewModel> factory)
Assert.AreEqual(tracker.CountChanges(viewModel), 0);
}

void ViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
void ViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
propertyChanged = true;
}
Expand Down Expand Up @@ -208,7 +236,7 @@ public void SuppressChanges_DoesWork(Func<IMessenger, ITestViewModel> factory)
Assert.AreEqual(tracker.CountChanges(viewModel), 0);
}

void ViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
void ViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
propertyChanged = true;
}
Expand Down Expand Up @@ -238,7 +266,7 @@ public void SuppressAllChanges_DoesWork(Func<IMessenger, ITestViewModel> factory
Assert.AreEqual(tracker.CountChanges(viewModel), 0);
}

void ViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
void ViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
propertyChanged = true;
}
Expand Down Expand Up @@ -271,7 +299,7 @@ public void SuppressChanges_Stacked_DoesWork(Func<IMessenger, ITestViewModel> fa
Assert.AreEqual(tracker.CountChanges(viewModel), 0);
}

void ViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
void ViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
propertyChanged = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="DynamicData" Version="7.12.11" />
<PackageReference Include="DynamicData" Version="7.13.5" />

<PackageReference Include="Nerdbank.GitVersioning" Version="3.5.119">
<PrivateAssets>all</PrivateAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ public void Upsert<T>(PropertyChangedMessage<T> message)
return;
}

actualChanges.IsActualChange = true;
actualChanges.IsActualChange = !AreEqual(actualChanges.InitialValue, message.NewValue);
actualChanges.NewValue = message.NewValue;
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<PackageReference Include="NSubstitute.Analyzers.CSharp" Version="1.0.16" />

<PackageReference Include="nunit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.3.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.4.2" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
<Reference Include="System.Numerics.Vectors" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2545" />
<PackageReference Include="Xamarin.Essentials" Version="1.7.4" />
<PackageReference Include="Xamarin.Essentials" Version="1.7.5" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2578" />
</ItemGroup>
<ItemGroup>
<Compile Include="MainActivity.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@
<Reference Include="System.Numerics.Vectors" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2545" />
<PackageReference Include="Xamarin.Essentials" Version="1.7.4" />
<PackageReference Include="Xamarin.Essentials" Version="1.7.5" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2578" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2545" />
<PackageReference Include="Xamarin.Essentials" Version="1.7.4" />
<PackageReference Include="Xamarin.Essentials" Version="1.7.5" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2578" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

<PackageReference Include="Xamarin.Forms" Version="5.0.0.2545" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2578" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit 417c1c2

Please sign in to comment.