public void GetStoreType_Throws_OnUnsupportedTypes() { var items = new[] { JTokenType.Comment, JTokenType.Constructor, JTokenType.None, JTokenType.Property, JTokenType.Raw, JTokenType.Undefined, JTokenType.Null }; foreach (var type in items) { var ex = Assert.Throws <NotSupportedException>(() => SqlHelpers.GetStoreType(type, allowNull: false)); Assert.Equal(ex.Message, String.Format("Property of type '{0}' is not supported.", type)); } }
public void GetStoreType_ReturnsCorrectType() { var data = new Dictionary <JTokenType, string>() { { JTokenType.Boolean, SqlColumnType.Boolean }, { JTokenType.Integer, SqlColumnType.Integer }, { JTokenType.Date, SqlColumnType.DateTime }, { JTokenType.Float, SqlColumnType.Float }, { JTokenType.String, SqlColumnType.Text }, { JTokenType.Guid, SqlColumnType.Guid }, { JTokenType.Array, SqlColumnType.Json }, { JTokenType.Object, SqlColumnType.Json }, { JTokenType.Bytes, SqlColumnType.Blob }, { JTokenType.Uri, SqlColumnType.Uri }, { JTokenType.TimeSpan, SqlColumnType.TimeSpan }, }; foreach (var item in data) { Assert.Equal(SqlHelpers.GetStoreType(item.Key, allowNull: false), item.Value); } }