예제 #1
0
        public void Clone <T>(CloneArguments <T> args)
        {
            args.Context = new Dictionary <object, object>(16, ReferenceEqualsComparer.Instance);
            CopyContext c = new CopyContext(args.Context);

            args.Target = Cloner <T> .Get(args.Source, c);
        }
예제 #2
0
 protected override void AfterJaggedArray2dOfSameInstance(
     CloneArguments <SimpleStruct?[][]> args)
 {
     base.AfterJaggedArray2dOfSameInstance(args);
     Assert.Single(args.Context.Keys.OfType <SimpleStruct?[][]>());
     Assert.Equal(args.Context.Keys.OfType <SimpleStruct?[]>().Count(), GetItemCount(args.Target[0]));
 }
예제 #3
0
        protected override void AfterArrayOfObjectsDiffInstance(
            CloneArguments <object[]> args)
        {
            base.AfterArrayOfObjectsDiffInstance(args);
            var count = (args.Target.Length * 2) + 1;

            Assert.Equal(count, args.Context.Count);
        }
예제 #4
0
        protected override void AfterArrayOfDiffInstance(
            CloneArguments <DoubleSimpleClass[]> args)
        {
            base.AfterArrayOfDiffInstance(args);
            var count = (args.Target.Length * 2) + 1;

            Assert.Equal(count, args.Context.Count);
        }
예제 #5
0
        protected override void AfterListOfObjectDiffInstance(
            CloneArguments <List <object> > args)
        {
            base.AfterListOfObjectDiffInstance(args);
            var count = (args.Target.Count * 2) + 1;

            Assert.Equal(count, args.Context.Count);
        }
예제 #6
0
        protected override void AfterListOfDiffInstance(
            CloneArguments <List <DoubleSimpleClass> > args)
        {
            base.AfterListOfDiffInstance(args);
            var count = (args.Target.Count * 2) + 1;

            Assert.Equal(count, args.Context.Count);
        }
예제 #7
0
        protected override void AfterMultiDimArrayRank3OfDiffInstance(
            CloneArguments <SimpleClass[, , ]> args)
        {
            base.AfterMultiDimArrayRank3OfDiffInstance(args);
            var count = (args.Target.GetLength(0) * args.Target.GetLength(1) * args.Target.GetLength(2)) + 1;

            Assert.Equal(count, args.Context.Count);
        }
예제 #8
0
        protected override void AfterJaggedArray2dOfDiffInstance(
            CloneArguments <DoubleSimpleClass[][]> args)
        {
            base.AfterJaggedArray2dOfDiffInstance(args);

            var itemCount = args.Target.Select(x => x.Length).Sum();

            var count = 1 + args.Target.Length + (itemCount * 2);

            Assert.Equal(count, args.Context.Count);
        }
예제 #9
0
파일: Base.cs 프로젝트: deipax/Deipax
        protected virtual void AfterArrayOfObjectsSameInstance(
            CloneArguments <object[]> args)
        {
            Assert.NotSame(args.Source, args.Target);
            Assert.Equal(args.Source.Length, args.Target.Length);

            for (int i = 0; i < args.Target.Length; i++)
            {
                Assert.Equal((T)args.Source[i], (T)args.Target[i], _generator.Comparer);
                Assert.True(AreSame((T)args.Target[0], (T)args.Target[i]));
            }
        }
예제 #10
0
파일: Base.cs 프로젝트: deipax/Deipax
        protected virtual void AfterArrayOfDiffInstance(
            CloneArguments <T[]> args)
        {
            Assert.NotSame(args.Source, args.Target);
            Assert.Equal(args.Source.Length, args.Target.Length);

            for (int i = 0; i < args.Target.Length; i++)
            {
                Assert.Equal(args.Source[i], args.Target[i], _generator.Comparer);

                if (i == 0)
                {
                    continue;
                }
                Assert.True(AreNotSame(args.Target[0], args.Target[i]));
            }
        }
예제 #11
0
 protected override void AfterSingleInstance(
     CloneArguments <SimpleStruct?> args)
 {
     base.AfterSingleInstance(args);
     Assert.Equal(0, args.Context.Count);
 }
예제 #12
0
 protected override void AfterDictionarySameInstance(
     CloneArguments <Dictionary <SimpleStruct?, SimpleStruct?> > args)
 {
     base.AfterDictionarySameInstance(args);
     Assert.Equal(1, args.Context.Count);
 }
예제 #13
0
 protected override void AfterArrayOfObjectsDiffInstance(
     CloneArguments <object[]> args)
 {
     base.AfterArrayOfObjectsDiffInstance(args);
     Assert.Equal(1, args.Context.Count);
 }
예제 #14
0
 protected override void AfterKeyValuePairSame(
     CloneArguments <KeyValuePair <SimpleStruct?, SimpleStruct?> > args)
 {
     base.AfterKeyValuePairSame(args);
     Assert.Equal(0, args.Context.Count);
 }
예제 #15
0
 protected override void AfterTupleDiffInstance(
     CloneArguments <Tuple <SimpleStruct?, SimpleStruct?> > args)
 {
     base.AfterTupleDiffInstance(args);
     Assert.Equal(1, args.Context.Count);
 }
예제 #16
0
 protected override void AfterJaggedArray2dOfSameInstance(
     CloneArguments <SimpleClass[][]> args)
 {
     base.AfterJaggedArray2dOfSameInstance(args);
     Assert.Equal(GetItemCount(args.Target[0]) + 2, args.Context.Count);
 }
예제 #17
0
 protected override void AfterListOfSameInstance(
     CloneArguments <List <SimpleStruct?> > args)
 {
     base.AfterListOfSameInstance(args);
     Assert.Equal(1, args.Context.Count);
 }
예제 #18
0
 protected override void AfterDefaultInstance(
     CloneArguments <int> args)
 {
     base.AfterDefaultInstance(args);
     Assert.Equal(0, args.Context.Count);
 }
예제 #19
0
 protected override void AfterArrayRank3OfSameInstance(
     CloneArguments <int[, , ]> args)
 {
     base.AfterArrayRank3OfSameInstance(args);
     Assert.Equal(1, args.Context.Count);
 }
예제 #20
0
 protected override void AfterArrayOfDiffInstance(
     CloneArguments <SimpleClass[]> args)
 {
     base.AfterArrayOfDiffInstance(args);
     Assert.Equal(args.Target.Length + 1, args.Context.Count);
 }
예제 #21
0
 protected override void AfterDictionaryDiffInstance(
     CloneArguments <Dictionary <int, int> > args)
 {
     base.AfterDictionaryDiffInstance(args);
     Assert.Equal(1, args.Context.Count);
 }
예제 #22
0
 protected override void AfterArrayOfDefaultInstance(
     CloneArguments <SimpleStruct?[]> args)
 {
     base.AfterArrayOfDefaultInstance(args);
     Assert.Equal(1, args.Context.Count);
 }
예제 #23
0
 protected override void AfterTupleSameInstance(
     CloneArguments <Tuple <SimpleClass, SimpleClass> > args)
 {
     base.AfterTupleSameInstance(args);
     Assert.Equal(2, args.Context.Count);
 }
예제 #24
0
 protected override void AfterMultiDimArrayRank2OfSameInstance(
     CloneArguments <SimpleClass[, ]> args)
 {
     base.AfterMultiDimArrayRank2OfSameInstance(args);
     Assert.Equal(2, args.Context.Count);
 }
예제 #25
0
 protected override void AfterJaggedArray2dOfDiffInstance(
     CloneArguments <SimpleStruct?[][]> args)
 {
     base.AfterJaggedArray2dOfDiffInstance(args);
     Assert.Equal(args.Target.Length + 1, args.Context.Count);
 }
예제 #26
0
 protected override void AfterListOfObjectSameInstance(
     CloneArguments <List <object> > args)
 {
     base.AfterListOfObjectSameInstance(args);
     Assert.Equal(1, args.Context.Count);
 }
예제 #27
0
 protected override void AfterKeyValuePairDiff(
     CloneArguments <KeyValuePair <int, int> > args)
 {
     base.AfterKeyValuePairDiff(args);
     Assert.Equal(0, args.Context.Count);
 }
예제 #28
0
 protected override void AfterDictionarySameInstance(
     CloneArguments <Dictionary <SimpleClass, SimpleClass> > args)
 {
     base.AfterDictionarySameInstance(args);
     Assert.Equal(args.Target.Keys.Count + 1, args.Context.Count);
 }
예제 #29
0
 protected override void AfterMultiDimArrayRank3OfDiffInstance(
     CloneArguments <SimpleStruct?[, , ]> args)
 {
     base.AfterMultiDimArrayRank3OfDiffInstance(args);
     Assert.Equal(1, args.Context.Count);
 }
예제 #30
0
 protected override void AfterTupleSameInstance(
     CloneArguments <Tuple <int, int> > args)
 {
     base.AfterTupleSameInstance(args);
     Assert.Equal(1, args.Context.Count);
 }