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)); }
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")); }
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); }
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); }
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); }
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); }