Skip to content

Commit db05a49

Browse files
Merge pull request #79 from dotnetprojects/postgre-test-reactivation
SQL Server CE - support has been discontinued - we do not support it any longer
2 parents cd77037 + 2f211fa commit db05a49

33 files changed

+182
-392
lines changed

lib/System.Data.SqlServerCe.dll

-265 KB
Binary file not shown.

src/Migrator.Tests/MigrationLoaderTest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Reflection;
2+
using DotNetProjects.Migrator;
23
using Migrator.Framework;
34
using Migrator.Framework.Loggers;
45
using NUnit.Framework;

src/Migrator.Tests/MigrationTypeComparerTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ namespace Migrator.Tests;
2121
[TestFixture]
2222
public class MigrationTypeComparerTest
2323
{
24-
private readonly Type[] _types = {
24+
private readonly Type[] _types = [
2525
typeof (Migration1),
2626
typeof (Migration2),
2727
typeof (Migration3)
28-
};
28+
];
2929

3030
[Migration(1, Ignore = true)]
3131
internal class Migration1 : Migration

src/Migrator.Tests/Providers/Base/TransformationProviderBase.cs

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public void ChangeColumn()
159159
{
160160
Provider.ChangeColumn("TestTwo", new Column("TestId", DbType.String, 50));
161161
Assert.That(Provider.ColumnExists("TestTwo", "TestId"), Is.True);
162-
Provider.Insert("TestTwo", new[] { "Id", "TestId" }, new object[] { 1, "Not an Int val." });
162+
Provider.Insert("TestTwo", ["Id", "TestId"], [1, "Not an Int val."]);
163163
}
164164

165165
[Test]
@@ -168,7 +168,7 @@ public void ChangeColumn_FromNullToNull()
168168
Provider.ChangeColumn("TestTwo", new Column("TestId", DbType.String, 50, ColumnProperty.Null));
169169
Provider.ChangeColumn("TestTwo", new Column("TestId", DbType.String, 50, ColumnProperty.Null));
170170
Provider.ChangeColumn("TestTwo", new Column("TestId", DbType.String, 50, ColumnProperty.Null));
171-
Provider.Insert("TestTwo", new[] { "Id", "TestId" }, new object[] { 2, "Not an Int val." });
171+
Provider.Insert("TestTwo", ["Id", "TestId"], [2, "Not an Int val."]);
172172
}
173173

174174
[Test]
@@ -307,8 +307,8 @@ public void CommitTwice()
307307
[Test]
308308
public void InsertData()
309309
{
310-
Provider.Insert("TestTwo", new[] { "Id", "TestId" }, new object[] { 1, "1" });
311-
Provider.Insert("TestTwo", new[] { "Id", "TestId" }, new object[] { 2, "2" });
310+
Provider.Insert("TestTwo", ["Id", "TestId"], [1, 1]);
311+
Provider.Insert("TestTwo", ["Id", "TestId"], [2, 2]);
312312

313313
using var cmd = Provider.CreateCommand();
314314
using var reader = Provider.Select(cmd, "TestId", "TestTwo");
@@ -323,8 +323,8 @@ public void CanInsertNullData()
323323
{
324324
AddTable();
325325

326-
Provider.Insert("Test", new[] { "Id", "Title" }, new[] { "1", "foo" });
327-
Provider.Insert("Test", new[] { "Id", "Title" }, new[] { "2", null });
326+
Provider.Insert("Test", ["Id", "Title"], [1, "foo"]);
327+
Provider.Insert("Test", ["Id", "Title"], [2, null]);
328328

329329
using var cmd = Provider.CreateCommand();
330330
using var reader = Provider.Select(cmd, "Title", "Test");
@@ -337,12 +337,16 @@ public void CanInsertNullData()
337337
[Test]
338338
public void CanInsertDataWithSingleQuotes()
339339
{
340+
// Arrange
341+
const string testString = "Test string with ' (single quote)";
340342
AddTable();
341-
Provider.Insert("Test", new[] { "Id", "Title" }, new[] { "1", "Muad'Dib" });
343+
Provider.Insert("Test", ["Id", "Title"], [1, testString]);
344+
342345
using var cmd = Provider.CreateCommand();
343346
using var reader = Provider.Select(cmd, "Title", "Test");
347+
344348
Assert.That(reader.Read(), Is.True);
345-
Assert.That("Muad'Dib", Is.EqualTo(reader.GetString(0)));
349+
Assert.That(testString, Is.EqualTo(reader.GetString(0)));
346350
Assert.That(reader.Read(), Is.False);
347351
}
348352

@@ -362,9 +366,12 @@ public void DeleteData()
362366
public void DeleteDataWithArrays()
363367
{
364368
InsertData();
365-
Provider.Delete("TestTwo", new[] { "TestId" }, new[] { "1" });
369+
370+
Provider.Delete("TestTwo", ["TestId"], [1]);
371+
366372
using var cmd = Provider.CreateCommand();
367373
using var reader = Provider.Select(cmd, "TestId", "TestTwo");
374+
368375
Assert.That(reader.Read(), Is.True);
369376
Assert.That(2, Is.EqualTo(Convert.ToInt32(reader[0])));
370377
Assert.That(reader.Read(), Is.False);
@@ -373,10 +380,10 @@ public void DeleteDataWithArrays()
373380
[Test]
374381
public void UpdateData()
375382
{
376-
Provider.Insert("TestTwo", new[] { "Id", "TestId" }, new object[] { 20, "1" });
377-
Provider.Insert("TestTwo", new[] { "Id", "TestId" }, new object[] { 21, "2" });
383+
Provider.Insert("TestTwo", ["Id", "TestId"], [20, 1]);
384+
Provider.Insert("TestTwo", ["Id", "TestId"], [21, 2]);
378385

379-
Provider.Update("TestTwo", new[] { "TestId" }, new[] { "3" });
386+
Provider.Update("TestTwo", ["TestId"], [3]);
380387
using var cmd = Provider.CreateCommand();
381388
using var reader = Provider.Select(cmd, "TestId", "TestTwo");
382389
var vals = GetVals(reader);
@@ -390,10 +397,10 @@ public void UpdateData()
390397
public void CanUpdateWithNullData()
391398
{
392399
AddTable();
393-
Provider.Insert("Test", new[] { "Id", "Title" }, new[] { "1", "foo" });
394-
Provider.Insert("Test", new[] { "Id", "Title" }, new[] { "2", null });
400+
Provider.Insert("Test", ["Id", "Title"], [1, "foo"]);
401+
Provider.Insert("Test", ["Id", "Title"], [2, null]);
395402

396-
Provider.Update("Test", new[] { "Title" }, new string[] { null });
403+
Provider.Update("Test", ["Title"], [null]);
397404
using var cmd = Provider.CreateCommand();
398405
using var reader = Provider.Select(cmd, "Title", "Test");
399406
var vals = GetStringVals(reader);
@@ -405,10 +412,10 @@ public void CanUpdateWithNullData()
405412
[Test]
406413
public void UpdateDataWithWhere()
407414
{
408-
Provider.Insert("TestTwo", ["Id", "TestId"], [10, "1"]);
409-
Provider.Insert("TestTwo", ["Id", "TestId"], [11, "2"]);
415+
Provider.Insert("TestTwo", ["Id", "TestId"], [10, 1]);
416+
Provider.Insert("TestTwo", ["Id", "TestId"], [11, 2]);
410417

411-
Provider.Update("TestTwo", ["TestId"], ["3"], "TestId='1'");
418+
Provider.Update("TestTwo", ["TestId"], [3], "TestId='1'");
412419
using var cmd = Provider.CreateCommand();
413420
using var reader = Provider.Select(cmd, "TestId", "TestTwo");
414421
var vals = GetVals(reader);

src/Migrator.Tests/Providers/Oracle/OracleTransformationProviderTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public void ChangeColumn_FromNotNullToNotNull()
3131
{
3232
Provider.ExecuteNonQuery("DELETE FROM TestTwo");
3333
Provider.ChangeColumn("TestTwo", new Column("TestId", DbType.String, 50, ColumnProperty.Null));
34-
Provider.Insert("TestTwo", new[] { "Id", "TestId" }, new object[] { 3, "Not an Int val." });
34+
Provider.Insert("TestTwo", ["Id", "TestId"], [3, "Not an Int val."]);
3535
Provider.ChangeColumn("TestTwo", new Column("TestId", DbType.String, 50, ColumnProperty.NotNull));
3636
Provider.ChangeColumn("TestTwo", new Column("TestId", DbType.String, 50, ColumnProperty.NotNull));
3737
}

src/Migrator.Tests/Providers/SQLServerCe/SqlServerCeTransformationProviderTest.cs

Lines changed: 0 additions & 68 deletions
This file was deleted.

src/Migrator/Compile/ScriptEngine.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public ScriptEngine(string[] extraReferencedAssemblies)
2424

2525
public ScriptEngine(string codeType, string[] extraReferencedAssemblies)
2626
{
27-
if (!String.IsNullOrEmpty(codeType))
27+
if (!string.IsNullOrEmpty(codeType))
2828
{
2929
_codeType = codeType;
3030
}
@@ -58,7 +58,7 @@ private string[] GetFilesRecursive(string directory)
5858
private FileInfo[] GetFilesRecursive(DirectoryInfo d)
5959
{
6060
var files = new List<FileInfo>();
61-
files.AddRange(d.GetFiles(String.Format("*.{0}", _provider.FileExtension)));
61+
files.AddRange(d.GetFiles(string.Format("*.{0}", _provider.FileExtension)));
6262
var subDirs = d.GetDirectories();
6363
if (subDirs.Length > 0)
6464
{

src/Migrator/DuplicatedVersionException.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
using System;
1515

16-
namespace Migrator;
16+
namespace DotNetProjects.Migrator;
1717

1818
/// <summary>
1919
/// Exception thrown when a migration number is not unique.
@@ -25,7 +25,7 @@ namespace Migrator;
2525
public class DuplicatedVersionException : Exception
2626
{
2727
public DuplicatedVersionException(long version)
28-
: base(String.Format("Migration version #{0} is duplicated", version))
28+
: base(string.Format("Migration version #{0} is duplicated", version))
2929
{
3030
}
3131
}

src/Migrator/Framework/DataRecordExtensions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,19 @@ public static T TryParse<T>(this IDataRecord record, string name, Func<T> defaul
4141
return (T)((object)value.ToString());
4242
}
4343

44-
if (type == typeof(Int32?) || type == typeof(Int32))
44+
if (type == typeof(int?) || type == typeof(int))
4545
{
4646
return (T)(object)Convert.ToInt32(value);
4747
}
4848

49-
if (type == typeof(Int64?) || type == typeof(Int64))
49+
if (type == typeof(long?) || type == typeof(long))
5050
{
5151
return (T)(object)Convert.ToInt64(value);
5252
}
5353

5454
if (type == typeof(bool) || type == typeof(bool?))
5555
{
56-
if (value is Int32 || value is Int64 || value is Int16 || value is UInt16 || value is UInt32 || value is UInt64)
56+
if (value is int || value is long || value is short || value is ushort || value is uint || value is ulong)
5757
{
5858
var intValue = Convert.ToInt64(value);
5959
return (T)(object)(intValue != 0);

src/Migrator/Framework/ITransformationProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public interface ITransformationProvider : IDisposable
3232
/// <summary>
3333
/// Connection string to the database
3434
/// </summary>
35-
String ConnectionString { get; }
35+
string ConnectionString { get; }
3636

3737
/// <summary>
3838
/// Logger used to log details of operations performed during migration

0 commit comments

Comments
 (0)