示例#1
0
        public void ConvertFromDataRecordFieldDateTimeTest()
        {
            // Arrange
            var field = new DataRecordField
            {
                Type  = FieldValueType.DateTime,
                Value = "2019-10-23T23:10:15"
            };

            // Act
            var result = _classUnderTest.Convert(field);

            // Assert
            result.Should().BeOfType(typeof(DateTime));
            result.Should().BeEquivalentTo(new DateTime(2019, 10, 23, 23, 10, 15, 0, DateTimeKind.Utc));
        }
示例#2
0
        public void ConvertFromDataRecordFieldGuidTest()
        {
            // Arrange
            var field = new DataRecordField
            {
                Type  = FieldValueType.Guid,
                Value = "e6541e3e-d555-41b8-9641-d436c38d038b"
            };

            // Act
            var result = _classUnderTest.Convert(field);

            // Assert
            result.Should().BeOfType(typeof(Guid));
            result.Should().BeEquivalentTo(Guid.Parse("e6541e3e-d555-41b8-9641-d436c38d038b"));
        }
示例#3
0
        public void ConvertFromDataRecordFieldDecimalTest()
        {
            // Arrange
            var field = new DataRecordField
            {
                Type  = FieldValueType.Decimal,
                Value = "10.5"
            };

            // Act
            var result = _classUnderTest.Convert(field);

            // Assert
            result.Should().BeOfType(typeof(decimal));
            result.Should().BeEquivalentTo(10.5m);
        }
示例#4
0
        public void ConvertFromDataRecordFieldTest(string value, object expectedvalue, FieldValueType fieldType, Type expectedType)
        {
            // Arrange
            var field = new DataRecordField
            {
                Type  = fieldType,
                Value = value
            };

            // Act
            var result = _classUnderTest.Convert(field);

            // Assert
            result.Should().BeOfType(expectedType);
            result.Should().BeEquivalentTo(expectedvalue);
        }
示例#5
0
        public void ConvertFromDataRecordFieldByteArrayTest()
        {
            // Arrange
            var binary = new byte[] { 1, 2, 3, 4 };

            // Arrange
            var field = new DataRecordField
            {
                Type  = FieldValueType.ByteArray,
                Value = binary.ToBase64().Compress().ToBase64()
            };

            // Act
            var result = _classUnderTest.Convert(field);

            // Assert
            result.Should().BeOfType(typeof(byte[]));
            result.Should().BeEquivalentTo(binary);
        }
示例#6
0
        public void ConvertFromDataRecordFieldXmlDocumentTest()
        {
            // Arrange
            var document = new XmlDocument();

            document.LoadXml("<root><alpha>Beta</alpha></root>");

            // Arrange
            var field = new DataRecordField
            {
                Type  = FieldValueType.XmlDocument,
                Value = document.OuterXml.Compress().ToBase64()
            };

            // Act
            var result = _classUnderTest.Convert(field);

            // Assert
            result.Should().BeOfType(typeof(XmlDocument));
            result.Should().BeEquivalentTo(document);
        }