コード例 #1
0
        public void SerializeAndDeserializeToTheSameObject(float originalValue)
        {
            Serializer <float> serializer = new SingleSerializer();

            byte[] serializedValue   = serializer.Serialize(originalValue);
            float  deserializedValue = serializer.Deserialize(serializedValue);

            Assert.Equal(originalValue, deserializedValue);
        }
コード例 #2
0
ファイル: WKTSerializers.cs プロジェクト: navirius/bitcare
 public WKTSerializers(ISerializerStorage serializerStorage, IValueTypeObjectsDictionary objectCache)
 {
     Boolean        = new BooleanSerializer(serializerStorage);
     Byte           = new ByteSerializer(serializerStorage);
     Char           = new CharSerializer(serializerStorage);
     DateTime       = new DateTimeSerializer(serializerStorage);
     DateTimeOffset = new DateTimeOffsetSerializer(serializerStorage);
     Decimal        = new DecimalSerializer(serializerStorage);
     Double         = new DoubleSerializer(serializerStorage);
     Guid           = new GuidSerializer(serializerStorage);
     Int16          = new Int16Serializer(serializerStorage);
     Int32          = new Int32Serializer(serializerStorage);
     Int64          = new Int64Serializer(serializerStorage);
     Object         = new ObjectSerializer(serializerStorage);
     SByte          = new SByteSerializer(serializerStorage);
     Single         = new SingleSerializer(serializerStorage);
     String         = new StringSerializer(serializerStorage, objectCache);
     TimeSpan       = new TimeSpanSerializer(serializerStorage);
     UInt16         = new UInt16Serializer(serializerStorage);
     UInt32         = new UInt32Serializer(serializerStorage);
 }
コード例 #3
0
        public void ShouldThrowIfDeserializingLessThanFourBytes(byte[] data)
        {
            Serializer <float> serializer = new SingleSerializer();

            Assert.Throws <ArgumentOutOfRangeException>(() => serializer.Deserialize(data));
        }
コード例 #4
0
        public void ShouldThrowIfDeserializingNull()
        {
            Serializer <float> serializer = new SingleSerializer();

            Assert.Throws <ArgumentNullException>(() => serializer.Deserialize(null));
        }