Skip to content

Commit

Permalink
Merge pull request #357 from brunck/merge-graph-unit-test
Browse files Browse the repository at this point in the history
Alter unit test to reproduce merge graph problem seen in issue #332
  • Loading branch information
rockfordlhotka authored Feb 3, 2020
2 parents ff2b2d9 + a73e902 commit 934e74e
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions src/MobileKidsIdApp.Models.Test/FamilyTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,29 @@ public async Task AddChild()
}

[TestMethod]
public async Task MergeSavedFamily()
[Description("This demonstrates the problem described in issue 332. " +
"Once fixed, this test should be updated to assert for the proper result which is that " +
"the two collections are functionally equal.")]
public async Task MergeSavedFamilyWithOnePhotoAdded()
{
const int totalChildren = 4;

var family = await Csla.DataPortal.FetchAsync<Models.Family>();
var child = family.AddNew();
var nextChild = family.AddNew();
child.Photos.AddNew();
nextChild.Photos.AddNew();
for (int i = 0; i < totalChildren; i++)
{
var child = family.AddNew();
// add photo to the last Child
if (i == totalChildren - 1)
{
child.Photos.AddNew();
}
}

var saved = await family.SaveAsync();

new Csla.Core.GraphMerger().MergeBusinessListGraph<Family, Child>(family, saved);
Assert.AreEqual(saved.Count, family.Count);
// TODO: fix issue 332 and once done, change this to check for equality to exercise that fix.
Assert.AreNotEqual(saved.Count, family.Count);
}

[TestMethod]
Expand Down

0 comments on commit 934e74e

Please sign in to comment.