V3 rc2 #2
@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<PackageReleaseNotes>Initial release (RC 1)</PackageReleaseNotes>
|
||||
<PackageReleaseNotes>Added Field type for by-field operations</PackageReleaseNotes>
|
||||
<PackageTags>JSON Document SQL</PackageTags>
|
||||
</PropertyGroup>
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
<AssemblyVersion>3.0.0.0</AssemblyVersion>
|
||||
<FileVersion>3.0.0.0</FileVersion>
|
||||
<VersionPrefix>3.0.0</VersionPrefix>
|
||||
<VersionSuffix>rc-1</VersionSuffix>
|
||||
<VersionSuffix>rc-2</VersionSuffix>
|
||||
<Authors>danieljsummers</Authors>
|
||||
<Company>Bit Badger Solutions</Company>
|
||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<PackageReleaseNotes>Initial release; migrated from BitBadger.Npgsql.Documents, with field and extension additions (RC 1)</PackageReleaseNotes>
|
||||
<PackageReleaseNotes>Adds Field type for by-field operations (BREAKING from rc-1); adds RemoveFields* functions</PackageReleaseNotes>
|
||||
<PackageTags>JSON Document PostgreSQL Npgsql</PackageTags>
|
||||
</PropertyGroup>
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<PackageReleaseNotes>Initial release; SQLite document implementation similar to BitBadger.Npgsql.Documents (RC 1)</PackageReleaseNotes>
|
||||
<PackageReleaseNotes>Adds Field type for by-field operations (BREAKING from rc-1); adds RemoveFields* functions</PackageReleaseNotes>
|
||||
<PackageTags>JSON Document SQLite</PackageTags>
|
||||
</PropertyGroup>
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Data.Sqlite" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Data.Sqlite" Version="8.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -719,7 +719,7 @@ public class PostgresCSharpExtensionTests
|
||||
await using var conn = MkConn(db);
|
||||
await LoadDocs();
|
||||
|
||||
await conn.RemoveFieldsById(PostgresDb.TableName, "two", [ "Sub", "Value" ]);
|
||||
await conn.RemoveFieldsById(PostgresDb.TableName, "two", new[] { "Sub", "Value" });
|
||||
var updated = await Find.ById<string, JsonDocument>(PostgresDb.TableName, "two");
|
||||
Expect.isNotNull(updated, "The updated document should have been retrieved");
|
||||
Expect.equal(updated.Value, "", "The string value should have been removed");
|
||||
@ -731,7 +731,7 @@ public class PostgresCSharpExtensionTests
|
||||
await using var conn = MkConn(db);
|
||||
await LoadDocs();
|
||||
|
||||
await conn.RemoveFieldsById(PostgresDb.TableName, "two", [ "Sub" ]);
|
||||
await conn.RemoveFieldsById(PostgresDb.TableName, "two", new[] { "Sub" });
|
||||
var updated = await Find.ById<string, JsonDocument>(PostgresDb.TableName, "two");
|
||||
Expect.isNotNull(updated, "The updated document should have been retrieved");
|
||||
Expect.notEqual(updated.Value, "", "The string value should not have been removed");
|
||||
@ -744,7 +744,7 @@ public class PostgresCSharpExtensionTests
|
||||
await LoadDocs();
|
||||
|
||||
// This not raising an exception is the test
|
||||
await conn.RemoveFieldsById(PostgresDb.TableName, "two", [ "AFieldThatIsNotThere" ]);
|
||||
await conn.RemoveFieldsById(PostgresDb.TableName, "two", new[] { "AFieldThatIsNotThere" });
|
||||
}),
|
||||
TestCase("succeeds when no document is matched", async () =>
|
||||
{
|
||||
@ -752,7 +752,7 @@ public class PostgresCSharpExtensionTests
|
||||
await using var conn = MkConn(db);
|
||||
|
||||
// This not raising an exception is the test
|
||||
await conn.RemoveFieldsById(PostgresDb.TableName, "two", [ "Value" ]);
|
||||
await conn.RemoveFieldsById(PostgresDb.TableName, "two", new[] { "Value" });
|
||||
})
|
||||
}),
|
||||
TestList("RemoveFieldsByField", new[]
|
||||
@ -763,7 +763,8 @@ public class PostgresCSharpExtensionTests
|
||||
await using var conn = MkConn(db);
|
||||
await LoadDocs();
|
||||
|
||||
await conn.RemoveFieldsByField(PostgresDb.TableName, Field.EQ("NumValue", "17"), [ "Sub", "Value" ]);
|
||||
await conn.RemoveFieldsByField(PostgresDb.TableName, Field.EQ("NumValue", "17"),
|
||||
new[] { "Sub", "Value" });
|
||||
var updated = await Find.ById<string, JsonDocument>(PostgresDb.TableName, "four");
|
||||
Expect.isNotNull(updated, "The updated document should have been retrieved");
|
||||
Expect.equal(updated.Value, "", "The string value should have been removed");
|
||||
@ -775,7 +776,7 @@ public class PostgresCSharpExtensionTests
|
||||
await using var conn = MkConn(db);
|
||||
await LoadDocs();
|
||||
|
||||
await conn.RemoveFieldsByField(PostgresDb.TableName, Field.EQ("NumValue", "17"), [ "Sub" ]);
|
||||
await conn.RemoveFieldsByField(PostgresDb.TableName, Field.EQ("NumValue", "17"), new[] { "Sub" });
|
||||
var updated = await Find.ById<string, JsonDocument>(PostgresDb.TableName, "four");
|
||||
Expect.isNotNull(updated, "The updated document should have been retrieved");
|
||||
Expect.notEqual(updated.Value, "", "The string value should not have been removed");
|
||||
@ -788,7 +789,7 @@ public class PostgresCSharpExtensionTests
|
||||
await LoadDocs();
|
||||
|
||||
// This not raising an exception is the test
|
||||
await conn.RemoveFieldsByField(PostgresDb.TableName, Field.EQ("NumValue", "17"), [ "Nothing" ]);
|
||||
await conn.RemoveFieldsByField(PostgresDb.TableName, Field.EQ("NumValue", "17"), new[] { "Nothing" });
|
||||
}),
|
||||
TestCase("succeeds when no document is matched", async () =>
|
||||
{
|
||||
@ -796,7 +797,8 @@ public class PostgresCSharpExtensionTests
|
||||
await using var conn = MkConn(db);
|
||||
|
||||
// This not raising an exception is the test
|
||||
await conn.RemoveFieldsByField(PostgresDb.TableName, Field.NE("Abracadabra", "apple"), [ "Value" ]);
|
||||
await conn.RemoveFieldsByField(PostgresDb.TableName, Field.NE("Abracadabra", "apple"),
|
||||
new[] { "Value" });
|
||||
})
|
||||
}),
|
||||
TestList("RemoveFieldsByContains", new[]
|
||||
@ -807,7 +809,8 @@ public class PostgresCSharpExtensionTests
|
||||
await using var conn = MkConn(db);
|
||||
await LoadDocs();
|
||||
|
||||
await conn.RemoveFieldsByContains(PostgresDb.TableName, new { NumValue = 17 }, [ "Sub", "Value" ]);
|
||||
await conn.RemoveFieldsByContains(PostgresDb.TableName, new { NumValue = 17 },
|
||||
new[] { "Sub", "Value" });
|
||||
var updated = await Find.ById<string, JsonDocument>(PostgresDb.TableName, "four");
|
||||
Expect.isNotNull(updated, "The updated document should have been retrieved");
|
||||
Expect.equal(updated.Value, "", "The string value should have been removed");
|
||||
@ -819,7 +822,7 @@ public class PostgresCSharpExtensionTests
|
||||
await using var conn = MkConn(db);
|
||||
await LoadDocs();
|
||||
|
||||
await conn.RemoveFieldsByContains(PostgresDb.TableName, new { NumValue = 17 }, [ "Sub" ]);
|
||||
await conn.RemoveFieldsByContains(PostgresDb.TableName, new { NumValue = 17 }, new[] { "Sub" });
|
||||
var updated = await Find.ById<string, JsonDocument>(PostgresDb.TableName, "four");
|
||||
Expect.isNotNull(updated, "The updated document should have been retrieved");
|
||||
Expect.notEqual(updated.Value, "", "The string value should not have been removed");
|
||||
@ -832,7 +835,7 @@ public class PostgresCSharpExtensionTests
|
||||
await LoadDocs();
|
||||
|
||||
// This not raising an exception is the test
|
||||
await conn.RemoveFieldsByContains(PostgresDb.TableName, new { NumValue = 17 }, [ "Nothing" ]);
|
||||
await conn.RemoveFieldsByContains(PostgresDb.TableName, new { NumValue = 17 }, new[] { "Nothing" });
|
||||
}),
|
||||
TestCase("succeeds when no document is matched", async () =>
|
||||
{
|
||||
@ -840,7 +843,8 @@ public class PostgresCSharpExtensionTests
|
||||
await using var conn = MkConn(db);
|
||||
|
||||
// This not raising an exception is the test
|
||||
await conn.RemoveFieldsByContains(PostgresDb.TableName, new { Abracadabra = "apple" }, [ "Value" ]);
|
||||
await conn.RemoveFieldsByContains(PostgresDb.TableName, new { Abracadabra = "apple" },
|
||||
new[] { "Value" });
|
||||
})
|
||||
}),
|
||||
TestList("RemoveFieldsByJsonPath", new[]
|
||||
@ -851,7 +855,8 @@ public class PostgresCSharpExtensionTests
|
||||
await using var conn = MkConn(db);
|
||||
await LoadDocs();
|
||||
|
||||
await conn.RemoveFieldsByJsonPath(PostgresDb.TableName, "$.NumValue ? (@ == 17)", [ "Sub", "Value" ]);
|
||||
await conn.RemoveFieldsByJsonPath(PostgresDb.TableName, "$.NumValue ? (@ == 17)",
|
||||
new[] { "Sub", "Value" });
|
||||
var updated = await Find.ById<string, JsonDocument>(PostgresDb.TableName, "four");
|
||||
Expect.isNotNull(updated, "The updated document should have been retrieved");
|
||||
Expect.equal(updated.Value, "", "The string value should have been removed");
|
||||
@ -863,7 +868,7 @@ public class PostgresCSharpExtensionTests
|
||||
await using var conn = MkConn(db);
|
||||
await LoadDocs();
|
||||
|
||||
await conn.RemoveFieldsByJsonPath(PostgresDb.TableName, "$.NumValue ? (@ == 17)", [ "Sub" ]);
|
||||
await conn.RemoveFieldsByJsonPath(PostgresDb.TableName, "$.NumValue ? (@ == 17)", new[] { "Sub" });
|
||||
var updated = await Find.ById<string, JsonDocument>(PostgresDb.TableName, "four");
|
||||
Expect.isNotNull(updated, "The updated document should have been retrieved");
|
||||
Expect.notEqual(updated.Value, "", "The string value should not have been removed");
|
||||
@ -876,7 +881,7 @@ public class PostgresCSharpExtensionTests
|
||||
await LoadDocs();
|
||||
|
||||
// This not raising an exception is the test
|
||||
await conn.RemoveFieldsByJsonPath(PostgresDb.TableName, "$.NumValue ? (@ == 17)", [ "Nothing" ]);
|
||||
await conn.RemoveFieldsByJsonPath(PostgresDb.TableName, "$.NumValue ? (@ == 17)", new[] { "Nothing" });
|
||||
}),
|
||||
TestCase("succeeds when no document is matched", async () =>
|
||||
{
|
||||
@ -885,7 +890,7 @@ public class PostgresCSharpExtensionTests
|
||||
|
||||
// This not raising an exception is the test
|
||||
await conn.RemoveFieldsByJsonPath(PostgresDb.TableName, "$.Abracadabra ? (@ == \"apple\")",
|
||||
[ "Value" ]);
|
||||
new[] { "Value" });
|
||||
})
|
||||
}),
|
||||
TestList("DeleteById", new[]
|
||||
|
@ -920,7 +920,7 @@ public static class PostgresCSharpTests
|
||||
await using var db = PostgresDb.BuildDb();
|
||||
await LoadDocs();
|
||||
|
||||
await RemoveFields.ById(PostgresDb.TableName, "two", [ "Sub", "Value" ]);
|
||||
await RemoveFields.ById(PostgresDb.TableName, "two", new[] { "Sub", "Value" });
|
||||
var updated = await Find.ById<string, JsonDocument>(PostgresDb.TableName, "two");
|
||||
Expect.isNotNull(updated, "The updated document should have been retrieved");
|
||||
Expect.equal(updated.Value, "", "The string value should have been removed");
|
||||
@ -931,7 +931,7 @@ public static class PostgresCSharpTests
|
||||
await using var db = PostgresDb.BuildDb();
|
||||
await LoadDocs();
|
||||
|
||||
await RemoveFields.ById(PostgresDb.TableName, "two", [ "Sub" ]);
|
||||
await RemoveFields.ById(PostgresDb.TableName, "two", new[] { "Sub" });
|
||||
var updated = await Find.ById<string, JsonDocument>(PostgresDb.TableName, "two");
|
||||
Expect.isNotNull(updated, "The updated document should have been retrieved");
|
||||
Expect.notEqual(updated.Value, "", "The string value should not have been removed");
|
||||
@ -943,14 +943,14 @@ public static class PostgresCSharpTests
|
||||
await LoadDocs();
|
||||
|
||||
// This not raising an exception is the test
|
||||
await RemoveFields.ById(PostgresDb.TableName, "two", [ "AFieldThatIsNotThere" ]);
|
||||
await RemoveFields.ById(PostgresDb.TableName, "two", new[] { "AFieldThatIsNotThere" });
|
||||
}),
|
||||
TestCase("succeeds when no document is matched", async () =>
|
||||
{
|
||||
await using var db = PostgresDb.BuildDb();
|
||||
|
||||
// This not raising an exception is the test
|
||||
await RemoveFields.ById(PostgresDb.TableName, "two", [ "Value" ]);
|
||||
await RemoveFields.ById(PostgresDb.TableName, "two", new[] { "Value" });
|
||||
})
|
||||
}),
|
||||
TestList("ByField", new[]
|
||||
@ -960,7 +960,8 @@ public static class PostgresCSharpTests
|
||||
await using var db = PostgresDb.BuildDb();
|
||||
await LoadDocs();
|
||||
|
||||
await RemoveFields.ByField(PostgresDb.TableName, Field.EQ("NumValue", "17"), [ "Sub", "Value" ]);
|
||||
await RemoveFields.ByField(PostgresDb.TableName, Field.EQ("NumValue", "17"),
|
||||
new[] { "Sub", "Value" });
|
||||
var updated = await Find.ById<string, JsonDocument>(PostgresDb.TableName, "four");
|
||||
Expect.isNotNull(updated, "The updated document should have been retrieved");
|
||||
Expect.equal(updated.Value, "", "The string value should have been removed");
|
||||
@ -971,7 +972,7 @@ public static class PostgresCSharpTests
|
||||
await using var db = PostgresDb.BuildDb();
|
||||
await LoadDocs();
|
||||
|
||||
await RemoveFields.ByField(PostgresDb.TableName, Field.EQ("NumValue", "17"), [ "Sub" ]);
|
||||
await RemoveFields.ByField(PostgresDb.TableName, Field.EQ("NumValue", "17"), new[] { "Sub" });
|
||||
var updated = await Find.ById<string, JsonDocument>(PostgresDb.TableName, "four");
|
||||
Expect.isNotNull(updated, "The updated document should have been retrieved");
|
||||
Expect.notEqual(updated.Value, "", "The string value should not have been removed");
|
||||
@ -983,14 +984,15 @@ public static class PostgresCSharpTests
|
||||
await LoadDocs();
|
||||
|
||||
// This not raising an exception is the test
|
||||
await RemoveFields.ByField(PostgresDb.TableName, Field.EQ("NumValue", "17"), [ "Nothing" ]);
|
||||
await RemoveFields.ByField(PostgresDb.TableName, Field.EQ("NumValue", "17"), new[] { "Nothing" });
|
||||
}),
|
||||
TestCase("succeeds when no document is matched", async () =>
|
||||
{
|
||||
await using var db = PostgresDb.BuildDb();
|
||||
|
||||
// This not raising an exception is the test
|
||||
await RemoveFields.ByField(PostgresDb.TableName, Field.NE("Abracadabra", "apple"), [ "Value" ]);
|
||||
await RemoveFields.ByField(PostgresDb.TableName, Field.NE("Abracadabra", "apple"),
|
||||
new[] { "Value" });
|
||||
})
|
||||
}),
|
||||
TestList("ByContains", new[]
|
||||
@ -1000,7 +1002,8 @@ public static class PostgresCSharpTests
|
||||
await using var db = PostgresDb.BuildDb();
|
||||
await LoadDocs();
|
||||
|
||||
await RemoveFields.ByContains(PostgresDb.TableName, new { NumValue = 17 }, [ "Sub", "Value" ]);
|
||||
await RemoveFields.ByContains(PostgresDb.TableName, new { NumValue = 17 },
|
||||
new[] { "Sub", "Value" });
|
||||
var updated = await Find.ById<string, JsonDocument>(PostgresDb.TableName, "four");
|
||||
Expect.isNotNull(updated, "The updated document should have been retrieved");
|
||||
Expect.equal(updated.Value, "", "The string value should have been removed");
|
||||
@ -1011,7 +1014,7 @@ public static class PostgresCSharpTests
|
||||
await using var db = PostgresDb.BuildDb();
|
||||
await LoadDocs();
|
||||
|
||||
await RemoveFields.ByContains(PostgresDb.TableName, new { NumValue = 17 }, [ "Sub" ]);
|
||||
await RemoveFields.ByContains(PostgresDb.TableName, new { NumValue = 17 }, new[] { "Sub" });
|
||||
var updated = await Find.ById<string, JsonDocument>(PostgresDb.TableName, "four");
|
||||
Expect.isNotNull(updated, "The updated document should have been retrieved");
|
||||
Expect.notEqual(updated.Value, "", "The string value should not have been removed");
|
||||
@ -1023,14 +1026,15 @@ public static class PostgresCSharpTests
|
||||
await LoadDocs();
|
||||
|
||||
// This not raising an exception is the test
|
||||
await RemoveFields.ByContains(PostgresDb.TableName, new { NumValue = 17 }, [ "Nothing" ]);
|
||||
await RemoveFields.ByContains(PostgresDb.TableName, new { NumValue = 17 }, new[] { "Nothing" });
|
||||
}),
|
||||
TestCase("succeeds when no document is matched", async () =>
|
||||
{
|
||||
await using var db = PostgresDb.BuildDb();
|
||||
|
||||
// This not raising an exception is the test
|
||||
await RemoveFields.ByContains(PostgresDb.TableName, new { Abracadabra = "apple" }, [ "Value" ]);
|
||||
await RemoveFields.ByContains(PostgresDb.TableName, new { Abracadabra = "apple" },
|
||||
new[] { "Value" });
|
||||
})
|
||||
}),
|
||||
TestList("ByJsonPath", new[]
|
||||
@ -1040,7 +1044,8 @@ public static class PostgresCSharpTests
|
||||
await using var db = PostgresDb.BuildDb();
|
||||
await LoadDocs();
|
||||
|
||||
await RemoveFields.ByJsonPath(PostgresDb.TableName, "$.NumValue ? (@ == 17)", [ "Sub", "Value" ]);
|
||||
await RemoveFields.ByJsonPath(PostgresDb.TableName, "$.NumValue ? (@ == 17)",
|
||||
new[] { "Sub", "Value" });
|
||||
var updated = await Find.ById<string, JsonDocument>(PostgresDb.TableName, "four");
|
||||
Expect.isNotNull(updated, "The updated document should have been retrieved");
|
||||
Expect.equal(updated.Value, "", "The string value should have been removed");
|
||||
@ -1051,7 +1056,7 @@ public static class PostgresCSharpTests
|
||||
await using var db = PostgresDb.BuildDb();
|
||||
await LoadDocs();
|
||||
|
||||
await RemoveFields.ByJsonPath(PostgresDb.TableName, "$.NumValue ? (@ == 17)", [ "Sub" ]);
|
||||
await RemoveFields.ByJsonPath(PostgresDb.TableName, "$.NumValue ? (@ == 17)", new[] { "Sub" });
|
||||
var updated = await Find.ById<string, JsonDocument>(PostgresDb.TableName, "four");
|
||||
Expect.isNotNull(updated, "The updated document should have been retrieved");
|
||||
Expect.notEqual(updated.Value, "", "The string value should not have been removed");
|
||||
@ -1063,7 +1068,7 @@ public static class PostgresCSharpTests
|
||||
await LoadDocs();
|
||||
|
||||
// This not raising an exception is the test
|
||||
await RemoveFields.ByJsonPath(PostgresDb.TableName, "$.NumValue ? (@ == 17)", [ "Nothing" ]);
|
||||
await RemoveFields.ByJsonPath(PostgresDb.TableName, "$.NumValue ? (@ == 17)", new[] { "Nothing" });
|
||||
}),
|
||||
TestCase("succeeds when no document is matched", async () =>
|
||||
{
|
||||
@ -1071,7 +1076,7 @@ public static class PostgresCSharpTests
|
||||
|
||||
// This not raising an exception is the test
|
||||
await RemoveFields.ByJsonPath(PostgresDb.TableName, "$.Abracadabra ? (@ == \"apple\")",
|
||||
[ "Value" ]);
|
||||
new[] { "Value" });
|
||||
})
|
||||
})
|
||||
}),
|
||||
|
@ -475,7 +475,7 @@ public static class SqliteCSharpExtensionTests
|
||||
await using var conn = Sqlite.Configuration.DbConn();
|
||||
await LoadDocs();
|
||||
|
||||
await conn.RemoveFieldsById(SqliteDb.TableName, "two", [ "Sub", "Value" ]);
|
||||
await conn.RemoveFieldsById(SqliteDb.TableName, "two", new[] { "Sub", "Value" });
|
||||
var updated = await Find.ById<string, JsonDocument>(SqliteDb.TableName, "two");
|
||||
Expect.isNotNull(updated, "The updated document should have been retrieved");
|
||||
Expect.equal(updated.Value, "", "The string value should have been removed");
|
||||
@ -488,7 +488,7 @@ public static class SqliteCSharpExtensionTests
|
||||
await LoadDocs();
|
||||
|
||||
// This not raising an exception is the test
|
||||
await conn.RemoveFieldsById(SqliteDb.TableName, "two", [ "AFieldThatIsNotThere" ]);
|
||||
await conn.RemoveFieldsById(SqliteDb.TableName, "two", new[] { "AFieldThatIsNotThere" });
|
||||
}),
|
||||
TestCase("succeeds when no document is matched", async () =>
|
||||
{
|
||||
@ -496,7 +496,7 @@ public static class SqliteCSharpExtensionTests
|
||||
await using var conn = Sqlite.Configuration.DbConn();
|
||||
|
||||
// This not raising an exception is the test
|
||||
await conn.RemoveFieldsById(SqliteDb.TableName, "two", [ "Value" ]);
|
||||
await conn.RemoveFieldsById(SqliteDb.TableName, "two", new[] { "Value" });
|
||||
})
|
||||
}),
|
||||
TestList("RemoveFieldsByField", new[]
|
||||
@ -507,7 +507,7 @@ public static class SqliteCSharpExtensionTests
|
||||
await using var conn = Sqlite.Configuration.DbConn();
|
||||
await LoadDocs();
|
||||
|
||||
await conn.RemoveFieldsByField(SqliteDb.TableName, Field.EQ("NumValue", 17), [ "Sub" ]);
|
||||
await conn.RemoveFieldsByField(SqliteDb.TableName, Field.EQ("NumValue", 17), new[] { "Sub" });
|
||||
var updated = await Find.ById<string, JsonDocument>(SqliteDb.TableName, "four");
|
||||
Expect.isNotNull(updated, "The updated document should have been retrieved");
|
||||
Expect.isNull(updated.Sub, "The sub-document should have been removed");
|
||||
@ -519,7 +519,7 @@ public static class SqliteCSharpExtensionTests
|
||||
await LoadDocs();
|
||||
|
||||
// This not raising an exception is the test
|
||||
await conn.RemoveFieldsByField(SqliteDb.TableName, Field.EQ("NumValue", 17), [ "Nothing" ]);
|
||||
await conn.RemoveFieldsByField(SqliteDb.TableName, Field.EQ("NumValue", 17), new[] { "Nothing" });
|
||||
}),
|
||||
TestCase("succeeds when no document is matched", async () =>
|
||||
{
|
||||
@ -527,7 +527,7 @@ public static class SqliteCSharpExtensionTests
|
||||
await using var conn = Sqlite.Configuration.DbConn();
|
||||
|
||||
// This not raising an exception is the test
|
||||
await conn.RemoveFieldsByField(SqliteDb.TableName, Field.NE("Abracadabra", "apple"), [ "Value" ]);
|
||||
await conn.RemoveFieldsByField(SqliteDb.TableName, Field.NE("Abracadabra", "apple"), new[] { "Value" });
|
||||
})
|
||||
}),
|
||||
TestList("DeleteById", new[]
|
||||
|
@ -45,14 +45,14 @@ public static class SqliteCSharpTests
|
||||
{
|
||||
TestCase("ById succeeds", () =>
|
||||
{
|
||||
Expect.equal(Sqlite.Query.RemoveFields.ById("tbl", [ new SqliteParameter("@name", "one") ]),
|
||||
Expect.equal(Sqlite.Query.RemoveFields.ById("tbl", new[] { new SqliteParameter("@name", "one") }),
|
||||
"UPDATE tbl SET data = json_remove(data, @name) WHERE data ->> 'Id' = @id",
|
||||
"Remove field by ID query not correct");
|
||||
}),
|
||||
TestCase("ByField succeeds", () =>
|
||||
{
|
||||
Expect.equal(Sqlite.Query.RemoveFields.ByField("tbl", Field.LT("Fly", 0),
|
||||
[ new SqliteParameter("@name0", "one"), new SqliteParameter("@name1", "two") ]),
|
||||
new[] { new SqliteParameter("@name0", "one"), new SqliteParameter("@name1", "two") }),
|
||||
"UPDATE tbl SET data = json_remove(data, @name0, @name1) WHERE data ->> 'Fly' < @field",
|
||||
"Remove field by field query not correct");
|
||||
})
|
||||
@ -94,14 +94,14 @@ public static class SqliteCSharpTests
|
||||
// Results are exhaustively executed in the context of other tests
|
||||
});
|
||||
|
||||
private static readonly List<JsonDocument> TestDocuments =
|
||||
[
|
||||
private static readonly List<JsonDocument> TestDocuments = new()
|
||||
{
|
||||
new() { Id = "one", Value = "FIRST!", NumValue = 0 },
|
||||
new() { Id = "two", Value = "another", NumValue = 10, Sub = new() { Foo = "green", Bar = "blue" } },
|
||||
new() { Id = "three", Value = "", NumValue = 4 },
|
||||
new() { Id = "four", Value = "purple", NumValue = 17, Sub = new() { Foo = "green", Bar = "red" } },
|
||||
new() { Id = "five", Value = "purple", NumValue = 18 }
|
||||
];
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Add the test documents to the database
|
||||
@ -574,7 +574,7 @@ public static class SqliteCSharpTests
|
||||
await using var db = await SqliteDb.BuildDb();
|
||||
await LoadDocs();
|
||||
|
||||
await RemoveFields.ById(SqliteDb.TableName, "two", [ "Sub", "Value" ]);
|
||||
await RemoveFields.ById(SqliteDb.TableName, "two", new[] { "Sub", "Value" });
|
||||
var updated = await Find.ById<string, JsonDocument>(SqliteDb.TableName, "two");
|
||||
Expect.isNotNull(updated, "The updated document should have been retrieved");
|
||||
Expect.equal(updated.Value, "", "The string value should have been removed");
|
||||
@ -586,14 +586,14 @@ public static class SqliteCSharpTests
|
||||
await LoadDocs();
|
||||
|
||||
// This not raising an exception is the test
|
||||
await RemoveFields.ById(SqliteDb.TableName, "two", [ "AFieldThatIsNotThere" ]);
|
||||
await RemoveFields.ById(SqliteDb.TableName, "two", new[] { "AFieldThatIsNotThere" });
|
||||
}),
|
||||
TestCase("succeeds when no document is matched", async () =>
|
||||
{
|
||||
await using var db = await SqliteDb.BuildDb();
|
||||
|
||||
// This not raising an exception is the test
|
||||
await RemoveFields.ById(SqliteDb.TableName, "two", [ "Value" ]);
|
||||
await RemoveFields.ById(SqliteDb.TableName, "two", new[] { "Value" });
|
||||
})
|
||||
}),
|
||||
TestList("ByField", new[]
|
||||
@ -603,7 +603,7 @@ public static class SqliteCSharpTests
|
||||
await using var db = await SqliteDb.BuildDb();
|
||||
await LoadDocs();
|
||||
|
||||
await RemoveFields.ByField(SqliteDb.TableName, Field.EQ("NumValue", 17), [ "Sub" ]);
|
||||
await RemoveFields.ByField(SqliteDb.TableName, Field.EQ("NumValue", 17), new[] { "Sub" });
|
||||
var updated = await Find.ById<string, JsonDocument>(SqliteDb.TableName, "four");
|
||||
Expect.isNotNull(updated, "The updated document should have been retrieved");
|
||||
Expect.isNull(updated.Sub, "The sub-document should have been removed");
|
||||
@ -614,14 +614,14 @@ public static class SqliteCSharpTests
|
||||
await LoadDocs();
|
||||
|
||||
// This not raising an exception is the test
|
||||
await RemoveFields.ByField(SqliteDb.TableName, Field.EQ("NumValue", 17), [ "Nothing" ]);
|
||||
await RemoveFields.ByField(SqliteDb.TableName, Field.EQ("NumValue", 17), new[] { "Nothing" });
|
||||
}),
|
||||
TestCase("succeeds when no document is matched", async () =>
|
||||
{
|
||||
await using var db = await SqliteDb.BuildDb();
|
||||
|
||||
// This not raising an exception is the test
|
||||
await RemoveFields.ByField(SqliteDb.TableName, Field.NE("Abracadabra", "apple"), [ "Value" ]);
|
||||
await RemoveFields.ByField(SqliteDb.TableName, Field.NE("Abracadabra", "apple"), new[] { "Value" });
|
||||
})
|
||||
})
|
||||
}),
|
||||
|
Loading…
Reference in New Issue
Block a user