예제 #1
0
        public void Create_WhenDecimals_ReturnsTableParamForFractalNumbers()
        {
            var values = new object[] { 1.1M, 2.2M, 3.3M };
            var param  = SqlServerTableParams.Create("myParam", typeof(decimal), DataTypeCode.FractalNumber, values);

            AssertIsCorrectTableParam(param, "myParam", "SisoFractals", values);
        }
예제 #2
0
        public void Create_WhenDoublesWhereOneIsNull_ReturnsTableParamForFractalNumbers()
        {
            var values = new object[] { 1.1d, null, 3.3d };
            var param  = SqlServerTableParams.Create("myParam", typeof(double?), DataTypeCode.FractalNumber, values);

            AssertIsCorrectTableParam(param, "myParam", "SisoFractals", values);
        }
예제 #3
0
        public void Create_WhenLongsWhereOneIsNull_ReturnsTableParamForIntegerNumbers()
        {
            var values = new object[] { 1L, null, 3L };
            var param  = SqlServerTableParams.Create("myParam", typeof(long?), DataTypeCode.IntegerNumber, values);

            AssertIsCorrectTableParam(param, "myParam", "SisoIntegers", values);
        }
예제 #4
0
        public void Create_WhenBooleansWhereOneIsNull_ReturnsTableParamForBooleans()
        {
            var values = new object[] { true, null, false };
            var param  = SqlServerTableParams.Create("myParam", typeof(bool?), DataTypeCode.Bool, values);

            AssertIsCorrectTableParam(param, "myParam", "SisoBooleans", values);
        }
예제 #5
0
        public void Create_WhenTextsWhereOneIsNull_ReturnsTableParamForTexts()
        {
            var values = new object[] { "Aplha", null, "Charlie" };
            var param  = SqlServerTableParams.Create("myParam", typeof(string), DataTypeCode.Text, values);

            AssertIsCorrectTableParam(param, "myParam", "SisoTexts", values);
        }
예제 #6
0
        public void Create_WhenStrings_ReturnsTableParamForStrings()
        {
            var values = new object[] { "Aplha", "Bravo", "Charlie" };
            var param  = SqlServerTableParams.Create("myParam", typeof(string), DataTypeCode.String, values);

            AssertIsCorrectTableParam(param, "myParam", "SisoStrings", values);
        }
예제 #7
0
        public void Create_WhenEnumsWhereOneIsNull_ReturnsTableParamForStrings()
        {
            var values = new object[] { ConsoleColor.Black, null, ConsoleColor.Red };
            var param  = SqlServerTableParams.Create("myParam", typeof(ConsoleColor?), DataTypeCode.Enum, values);

            AssertIsCorrectTableParam(param, "myParam", "SisoStrings", values.Select(v => v == null ? null : v.ToString()).ToArray());
        }
예제 #8
0
        public void Create_WhenIntegers_ReturnsTableParamForIntegerNumbers()
        {
            var values = new object[] { 1, 2, 3 };
            var param  = SqlServerTableParams.Create("myParam", typeof(int), DataTypeCode.IntegerNumber, values);

            AssertIsCorrectTableParam(param, "myParam", "SisoIntegers", values);
        }
예제 #9
0
        public void Create_WhenGuidsWhereOneIsNull_ReturnsTableParamForGuids()
        {
            var values = new object[] { Guid.Parse("46a56b21-6b2d-4d05-8187-ad2200402219"), Guid.Parse("b6748652-43d5-48a4-b474-23f74ca0fd6e"), Guid.Parse("644b1369-d03b-41e1-9205-73273c3d790d") };
            var param  = SqlServerTableParams.Create("myParam", typeof(Guid?), DataTypeCode.Guid, values);

            AssertIsCorrectTableParam(param, "myParam", "SisoGuids", values);
        }
예제 #10
0
        public void Create_WhenDatesWhereOneIsNull_ReturnsTableParamForDates()
        {
            var origo  = new DateTime(2012, 1, 2, 3, 4, 5);
            var values = new object[] { null, origo, origo.AddDays(1) };
            var param  = SqlServerTableParams.Create("myParam", typeof(DateTime?), DataTypeCode.DateTime, values);

            AssertIsCorrectTableParam(param, "myParam", "SisoDates", values);
        }
예제 #11
0
        public void Create_WhenTextsWhereOneIsToLong_ReturnsTableParamForStrings()
        {
            var toLongValue = new string('a', SqlServerTableParams.MaxTextLength + 1);
            var values      = new object[] { "Aplha", toLongValue, "Charlie" };

            var ex = Assert.Throws <SisoDbException>(() => SqlServerTableParams.Create("myParam", typeof(string), DataTypeCode.Text, values));

            Assert.AreEqual(ExceptionMessages.SqlServerTableParams_ToLongString.Inject(SqlServerTableParams.MaxStringLength, toLongValue), ex.Message);
        }