public override void Compare(IComparison <RandomPopulationSettings> comparison) { CompareValues(x => x.BaseIndividual.Name, PKSimConstants.UI.BasedOnIndividual, comparison); CompareValues(x => x.NumberOfIndividuals, PKSimConstants.UI.NumberOfIndividuals, comparison); _enumerableComparer.CompareEnumerables(comparison, x => x.GenderRatios, x => x.Gender); _enumerableComparer.CompareEnumerables(comparison, x => x.ParameterRanges, x => x.ParameterDisplayName); }
public void CorrectlyDetectsChangesForUpdates() { //Arrange var oldList = new List <SampleTestClass>() { new SampleTestClass() { Id = 1, Content = "old1" } }; var newList = new List <SampleTestClass>() { new SampleTestClass() { Id = 1, Content = "new2" } }; //Act var result = EnumerableComparer.CompareEnumerables(oldList, newList, (item) => item.Id); //Assert Assert.Empty(result.Added); Assert.Empty(result.Removed); Assert.Single(result.Updated); var updatedItem = result.Updated.Single(); Assert.Equal("old1", updatedItem.Old.Content); Assert.Equal("new2", updatedItem.New.Content); }
public void CorrectlyDetectsChangesForMultipleThings() { //Arrange var oldList = new List <SampleTestClass>() { new SampleTestClass() { Id = 1, Content = "old1" }, new SampleTestClass() { Id = 2, Content = "old2" }, new SampleTestClass() { Id = 3, Content = "old3" } }; var newList = new List <SampleTestClass>() { new SampleTestClass() { Id = 2, Content = "new2" }, new SampleTestClass() { Id = 3, Content = "new3" }, new SampleTestClass() { Id = 4, Content = "new4" }, new SampleTestClass() { Id = 5, Content = "new5" } }; //Act var result = EnumerableComparer.CompareEnumerables(oldList, newList, (item) => item.Id); //Assert Assert.Equal(2, result.Added.Count); Assert.Equal("new4", result.Added[0].Content); Assert.Equal("new5", result.Added[1].Content); Assert.Single(result.Removed); Assert.Equal("old1", result.Removed[0].Content); Assert.Equal(2, result.Updated.Count); var updated1 = result.Updated[0]; var updated2 = result.Updated[1]; Assert.Equal("old2", updated1.Old.Content); Assert.Equal("new2", updated1.New.Content); Assert.Equal("old3", updated2.Old.Content); Assert.Equal("new3", updated2.New.Content); }
public override void Compare(IComparison <Individual> comparison) { _comparer.Compare(comparison.ChildComparison(x => x.OriginData)); _enumerableComparer.CompareEnumerables(comparison, x => x.AllExpressionProfiles().AllNames(), x => x, missingItemType: PKSimConstants.ObjectTypes.ExpressionProfile); _containerDiffBuilder.Compare(comparison); }
public override void Compare(IComparison <AdvancedParameter> comparison) { _enumerableComparer.CompareEnumerables(comparison, x => x.AllParameters, x => x.Name); }
public override void Compare(IComparison <ImportPopulationSettings> comparison) { _enumerableComparer.CompareEnumerables(comparison, x => x.AllFiles, x => x.FilePath); }