private void Execute(TypeModel model, string caption)
 {
     var large = new LargeType { Foo = 1, Bar = "abc" };
     SmallType small;
     using(var ms = new MemoryStream())
     {
         model.Serialize(ms, large);
         ms.Position = 0;
         small = (SmallType) model.Deserialize(ms, null, typeof(SmallType));
     }
     Assert.IsNotNull(small, caption);
 }
        private void ExecuteImpl(TypeModel model, string caption)
        {
            var large = new LargeType {
                Foo = 1, Bar = "abc"
            };
            SmallType small;

            using (var ms = new MemoryStream())
            {
                model.Serialize(ms, large);
                ms.Position = 0;
                small       = (SmallType)model.Deserialize(ms, null, typeof(SmallType));
            }
            Assert.NotNull(small); //, caption);
        }
Beispiel #3
0
        public void Execute()
        {
            var model = TypeModel.Create();
            var large = new LargeType {
                Foo = 1, Bar = "abc"
            };
            SmallType small;

            using (var ms = new MemoryStream())
            {
                model.Serialize(ms, large);
                ms.Position = 0;
                small       = (SmallType)model.Deserialize(ms, null, typeof(SmallType));
            }
            string s = small.Bar;
        }
Beispiel #4
0
    public override ILarge GetLarge(LargeType largeType)
    {
        switch (largeType)
        {
        case LargeType.Cabbage:
            ILarge cabbage = new Cabbage();
            return(cabbage);

        case LargeType.Pineapple:
            ILarge pineapple = new Pineapple();
            return(pineapple);

        case LargeType.Pumpkin:
            ILarge pumpkin = new Pumpkin();
            return(pumpkin);
        }
        return(null);
    }
#pragma warning disable IDE0060
        private void ExecuteImpl(TypeModel model, string caption)
#pragma warning restore IDE0060
        {
            var large = new LargeType {
                Foo = 1, Bar = "abc"
            };
            SmallType small;

            using (var ms = new MemoryStream())
            {
                model.Serialize(ms, large);
                ms.Position = 0;
#pragma warning disable CS0618
                small = (SmallType)model.Deserialize(ms, null, typeof(SmallType));
#pragma warning restore CS0618
            }
            Assert.NotNull(small); //, caption);
        }
Beispiel #6
0
 public void Execute()
 {
     var model = TypeModel.Create();
     var large = new LargeType { Foo = 1, Bar = "abc" };
     SmallType small;
     using (var ms = new MemoryStream())
     {
         model.Serialize(ms, large);
         ms.Position = 0;
         small = (SmallType)model.Deserialize(ms, null, typeof(SmallType));
     }
     string s = small.Bar;
 }
Beispiel #7
0
 public override ILarge GetLarge(LargeType largeType)
 {
     return(null);
 }
Beispiel #8
0
 public abstract ILarge GetLarge(LargeType largeType);