public void ShouldUseDecimalValuesListInQuery(ValuesListUsageTestCase <decimal> testCase) { // When decimal[] actual; using (var connection = ConnectionsFactory.Create()) { connection.Execute(@" if type_id (N'[dbo].[DecimalValuesList]') is null create type [dbo].[DecimalValuesList] as table([Value] [numeric](6,3) not null)"); actual = connection.Query <decimal>(@" select [Value] from @Param", new { Param = PrimitiveValuesList.Create( "DecimalValuesList", testCase.Source, new MetaDataCreationOptions { Precision = 6, Scale = 3 } ) }) .ToArray(); } // Then Assert.Equal(testCase.Source, actual); }
public async Task ShouldUseInt32ValuesListInQuery(ValuesListUsageTestCase <int> testCase) { // When int[] actual; using (var connection = ConnectionsFactory.Create()) { connection.Execute(CreateTableQuery()); actual = (await connection.QueryAsync <int>(GetAllValuesQuery(testCase.Source))).ToArray(); } // Then Assert.Equal(testCase.Source, actual); }
public void ShouldUseInt64ValuesListInQuery(ValuesListUsageTestCase <long> testCase) { // When long[] actual; using (var connection = ConnectionsFactory.Create()) { connection.Execute(@" if type_id (N'[dbo].[Int64ValuesList]') is null create type [dbo].[Int64ValuesList] as table([Value] [bigint] not null)"); actual = connection.Query <long>(@" select [Value] from @Param", new { Param = new Int64ValuesList("Int64ValuesList", testCase.Source) }) .ToArray(); } // Then Assert.Equal(testCase.Source, actual); }