コード例 #1
0
 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);
 }
コード例 #2
0
            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);
            }
コード例 #3
0
            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);
            }
コード例 #4
0
 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);
 }
コード例 #5
0
 public override void Compare(IComparison <AdvancedParameter> comparison)
 {
     _enumerableComparer.CompareEnumerables(comparison, x => x.AllParameters, x => x.Name);
 }
コード例 #6
0
 public override void Compare(IComparison <ImportPopulationSettings> comparison)
 {
     _enumerableComparer.CompareEnumerables(comparison, x => x.AllFiles, x => x.FilePath);
 }