[TestMethod] public void LookupNullableDecimal() { // Arrange var type = typeof(decimal?); // Act var supported = DBType.IsSupported(type); var dbType = DBType.Lookup(type); // Assert supported.Should().BeTrue(); dbType.Should().Be(DBType.Decimal); }
[TestMethod] public void LookupUShort() { // Arrange var type = typeof(ushort); // Act var supported = DBType.IsSupported(type); var dbType = DBType.Lookup(type); // Assert supported.Should().BeTrue(); dbType.Should().Be(DBType.UInt16); }
[TestMethod] public void LookupNullableEnum() { // Arrange var type = typeof(DataAccessMethod?); // Act var supported = DBType.IsSupported(type); var dbType = DBType.Lookup(type); // Assert supported.Should().BeTrue(); dbType.Should().Be(DBType.Enumeration); }
[TestMethod] public void LookupNullableSbyte() { // Arrange var type = typeof(sbyte?); // Act var supported = DBType.IsSupported(type); var dbType = DBType.Lookup(type); // Assert supported.Should().BeTrue(); dbType.Should().Be(DBType.Int8); }
[TestMethod] public void LookupNullableFloat() { // Arrange var type = typeof(float?); // Act var supported = DBType.IsSupported(type); var dbType = DBType.Lookup(type); // Assert supported.Should().BeTrue(); dbType.Should().Be(DBType.Single); }
[TestMethod] public void LookupNullableULong() { // Arrange var type = typeof(ulong?); // Act var supported = DBType.IsSupported(type); var dbType = DBType.Lookup(type); // Assert supported.Should().BeTrue(); dbType.Should().Be(DBType.UInt64); }
[TestMethod] public void LookupChar() { // Arrange var type = typeof(char); // Act var supported = DBType.IsSupported(type); var dbType = DBType.Lookup(type); // Assert supported.Should().BeTrue(); dbType.Should().Be(DBType.Character); }
[TestMethod] public void LookupBool() { // Arrange var type = typeof(bool); // Act var supported = DBType.IsSupported(type); var dbType = DBType.Lookup(type); // Assert supported.Should().BeTrue(); dbType.Should().Be(DBType.Boolean); }
[TestMethod] public void LookupString() { // Arrange var type = typeof(string); // Act var supported = DBType.IsSupported(type); var dbType = DBType.Lookup(type); // Assert supported.Should().BeTrue(); dbType.Should().Be(DBType.Text); }
[TestMethod] public void LookupDateTime() { // Arrange var type = typeof(DateTime); // Act var supported = DBType.IsSupported(type); var dbType = DBType.Lookup(type); // Assert supported.Should().BeTrue(); dbType.Should().Be(DBType.DateTime); }
[TestMethod] public void LookupCollection() { // Arrange var type = typeof(List <string>); // Act var supported = DBType.IsSupported(type); Func <DBType> action = () => DBType.Lookup(type); // Assert supported.Should().BeFalse(); action.Should().ThrowExactly <ArgumentException>() .WithAnyMessage() .And .ParamName.Should().NotBeNullOrEmpty(); }