[TestMethod] public void CreateFromUShortDirectly() { // Arrange var rawValue = (ushort)102; var expectedType = DBType.UInt16; // Act var value = new DBValue(rawValue); var matches = value.IsInstanceOf(expectedType); // Assert value.Datum.Should().Be(rawValue); matches.Should().BeTrue(); }
[TestMethod] public void CreateFromDecimalDirectly() { // Arrange var rawValue = (decimal)86.77; var expectedType = DBType.Decimal; // Act var value = new DBValue(rawValue); var matches = value.IsInstanceOf(expectedType); // Assert value.Datum.Should().Be(rawValue); matches.Should().BeTrue(); }
[TestMethod] public void CreateFromCharDirectly() { // Arrange var rawValue = '%'; var expectedType = DBType.Character; // Act var value = new DBValue(rawValue); var matches = value.IsInstanceOf(expectedType); // Assert value.Datum.Should().Be(rawValue); matches.Should().BeTrue(); }
[TestMethod] public void CreateFromFloatDirectly() { // Arrange var rawValue = -99.000102f; var expectedType = DBType.Single; // Act var value = new DBValue(rawValue); var matches = value.IsInstanceOf(expectedType); // Assert value.Datum.Should().Be(rawValue); matches.Should().BeTrue(); }
[TestMethod] public void CreateFromStringDirectly() { // Arrange var rawValue = "Kvasir"; var expectedType = DBType.Text; // Act var value = new DBValue(rawValue); var matches = value.IsInstanceOf(expectedType); // Assert value.Datum.Should().Be(rawValue); matches.Should().BeTrue(); }
[TestMethod] public void CreateFromGuidDirectly() { // Arrange var rawValue = new Guid(0, 1, 1, new byte[] { 2, 3, 5, 8, 13, 21, 34, 55 }); var expectedType = DBType.Guid; // Act var value = new DBValue(rawValue); var matches = value.IsInstanceOf(expectedType); // Assert value.Datum.Should().Be(rawValue); matches.Should().BeTrue(); }
[TestMethod] public void CreateFromDateTimeDirectly() { // Arrange var rawValue = new DateTime(1996, 02, 29); var expectedType = DBType.DateTime; // Act var value = new DBValue(rawValue); var matches = value.IsInstanceOf(expectedType); // Assert value.Datum.Should().Be(rawValue); matches.Should().BeTrue(); }
[TestMethod] public void CreateFromULongDirectly() { // Arrange var rawValue = 111110108ul; var expectedType = DBType.UInt64; // Act var value = new DBValue(rawValue); var matches = value.IsInstanceOf(expectedType); // Assert value.Datum.Should().Be(rawValue); matches.Should().BeTrue(); }