IMegaImageInfo IMsgPackConverter <IMegaImageInfo> .Read(IMsgPackReader reader)
        {
            var imageInfo = new MegaImageInfo();
            var nullable  = reader.ReadMapLength();

            if (!nullable.HasValue)
            {
                return(null);
            }
            for (var index = 0; index < nullable.Value; ++index)
            {
                var str = _stringConverter.Value.Read(reader);
                if (ReadImageInfoBody(str, imageInfo, reader))
                {
                    continue;
                }

                if (str == "CreationDate")
                {
                    imageInfo.SomeDate = _dateTimeConverter.Value.Read(reader);
                }
                else
                {
                    reader.SkipToken();
                }
            }

            return(imageInfo);
        }
Exemplo n.º 2
0
        public void InterfaceInheritance(ContextFixtureBase fixture)
        {
            IMegaImageInfo expected = new MegaImageInfo
            {
                Credits  = Guid.NewGuid().ToString("N"),
                Height   = 123,
                Link     = Guid.NewGuid().ToString("N"),
                SomeDate = DateTime.UtcNow,
                Width    = 345
            };

            var actual = MsgPackSerializer.Deserialize <IMegaImageInfo>(MsgPackSerializer.Serialize(expected, fixture.OldContext), fixture.NewContext);

            actual.ShouldBeAssignableTo <IMegaImageInfo>();
            AssertEqual(actual, expected);
        }