-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Arve Hansen
committed
Jun 26, 2024
1 parent
b79f418
commit c7023ce
Showing
3 changed files
with
79 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
namespace CrossRDBMS.Tests.CopyFromMssToPg; | ||
|
||
[Collection(nameof(DatabaseCollection))] | ||
public class CopyMisc : CopyMssToPgBase | ||
{ | ||
public CopyMisc(DatabaseFixture fixture, ITestOutputHelper output) : base(fixture, output) | ||
{ | ||
PgArguments = ParamHelper.GetInPg( | ||
fixture.PgConnectionString, | ||
mappingsFile: "mymappings.json"); | ||
} | ||
|
||
[Fact] | ||
public async Task CopyBit_To_Boolean() | ||
{ | ||
var tableName = GetName(nameof(CopyFromMssToPg)); | ||
var colValue = 1; | ||
var col = new SqlServerBit(101, "col1", false); | ||
MapTo("boolean"); | ||
|
||
await TestSingleTypeAsync( | ||
tableName, col, colValue.ToString(), "boolean"); | ||
|
||
await ValidateValueAsync(("public", tableName), true); | ||
} | ||
|
||
[Fact] | ||
public async Task CopyBit_To_SmallInt() | ||
{ | ||
var tableName = GetName(nameof(CopyFromMssToPg)); | ||
var colValue = 1; | ||
var col = new SqlServerBit(101, "col1", false); | ||
MapTo("smallint"); | ||
|
||
await TestSingleTypeAsync( | ||
tableName, col, colValue.ToString(), "smallint"); | ||
|
||
await ValidateValueAsync(("public", tableName), (short)colValue); | ||
} | ||
|
||
[Fact] | ||
public async Task CopyBit_To_Int() | ||
{ | ||
var tableName = GetName(nameof(CopyFromMssToPg)); | ||
var colValue = 1; | ||
var col = new SqlServerBit(101, "col1", false); | ||
MapTo("int"); | ||
|
||
await TestSingleTypeAsync( | ||
tableName, col, colValue.ToString(), "integer"); | ||
|
||
await ValidateValueAsync(("public", tableName), colValue); | ||
} | ||
|
||
private void MapTo(string mapTo) | ||
{ | ||
DummyFileSystem.AddFile(@"c:\mymappings.json", GetMappingFile( | ||
$" \"bit\": \"{mapTo}\"\r\n")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters