Skip to content
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,9 @@ dotnet_style_require_accessibility_modifiers = for_non_interface_members
# 'using' directive preferences
csharp_using_directive_placement = outside_namespace:warning

# CS8625: Cannot convert null literal to non-nullable reference type.
dotnet_diagnostic.CS8625.severity = error


##########################################
# Disable various diagnostics
Expand Down
10 changes: 5 additions & 5 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<PackageVersion Include="Npgsql" Version="10.0.1" />
<PackageVersion Include="NSubstitute" Version="5.3.0" />
<PackageVersion Include="NSubstitute.Analyzers.CSharp" Version="1.0.17" />
<PackageVersion Include="Rnd" Version="10.1.2" />
<PackageVersion Include="Rnd" Version="10.2.0" />
<PackageVersion Include="Serilog" Version="4.3.0" />
<PackageVersion Include="Serilog.Extensions.Hosting" Version="10.0.0" />
<PackageVersion Include="Serilog.Sinks.Async" Version="2.1.0" />
Expand All @@ -45,10 +45,10 @@
<PackageVersion Include="System.Data.SQLite.Core" Version="1.0.119" />
<PackageVersion Include="System.IdentityModel.Tokens.Jwt" Version="8.15.0" />
<PackageVersion Include="System.Text.Json" Version="10.0.2" />
<PackageVersion Include="Wrap" Version="1.0.0" />
<PackageVersion Include="Wrap.Id.Dapper" Version="1.0.0" />
<PackageVersion Include="Wrap.Id.Mvc" Version="1.0.0" />
<PackageVersion Include="Wrap.Testing" Version="1.0.0" />
<PackageVersion Include="Wrap" Version="1.1.0-beta.4" />
<PackageVersion Include="Wrap.Id.Dapper" Version="1.1.0-beta.4" />
<PackageVersion Include="Wrap.Id.Mvc" Version="1.1.0-beta.4" />
<PackageVersion Include="Wrap.Testing" Version="1.1.0-beta.4" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" />
<PackageVersion Include="xunit.v3" Version="3.2.2" />
<PackageVersion Include="xunit.v3.assert" Version="3.2.2" />
Expand Down
1 change: 0 additions & 1 deletion apps/AppConsolePg/Db.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using Jeebs.Data;
using Jeebs.Logging;
using Microsoft.Extensions.Options;
using Wrap.Extensions;

namespace AppConsolePg;

Expand Down
2 changes: 1 addition & 1 deletion src/Jeebs.Data/Query/FluentQuery.Sort.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public IFluentQuery<TEntity, TId> Sort<TValue>(Expression<Func<TEntity, TValue>>
aliasSelector.GetPropertyInfo()
.Match(
some: x => Sort(x.Name, order),
none: this
none: () => this
);
}
6 changes: 3 additions & 3 deletions src/Jeebs.Data/Query/FluentQuery.Where.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public IFluentQuery<TEntity, TId> Where<TValue>(Expression<Func<TEntity, TValue>
aliasSelector.GetPropertyInfo()
.Match(
some: x => Where(x.Name, compare, value),
none: this
none: () => this
);

/// <inheritdoc/>
Expand Down Expand Up @@ -105,7 +105,7 @@ public IFluentQuery<TEntity, TId> WhereIn<TValue>(Expression<Func<TEntity, TValu
aliasSelector.GetPropertyInfo()
.Match(
some: x => WhereIn(x.Name, values),
none: this
none: () => this
);

/// <inheritdoc/>
Expand All @@ -124,6 +124,6 @@ public IFluentQuery<TEntity, TId> WhereNotIn<TValue>(Expression<Func<TEntity, TV
aliasSelector.GetPropertyInfo()
.Match(
some: x => WhereNotIn(x.Name, values),
none: this
none: () => this
);
}
2 changes: 1 addition & 1 deletion src/Jeebs.Logging.Serilog.MySql/MySqlLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public MySqlLogger(string name) =>
public bool IsEnabled(MySqlConnectorLogLevel level) =>
LevelF.ConvertToSerilogLevel(level).Match(
some: Logger.IsEnabled,
none: false
none: () => false
);

/// <summary>
Expand Down
3 changes: 1 addition & 2 deletions src/Jeebs/Config/App/AppConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Copyright (c) bfren - licensed under https://mit.bfren.dev/2013

using System;
using Jeebs.Functions;
using Microsoft.Extensions.Options;

namespace Jeebs.Config.App;
Expand Down Expand Up @@ -32,7 +31,7 @@ public sealed record class AppConfig : IOptions<AppConfig>
/// otherwise simply <see cref="Name"/>.
/// </summary>
public string FullName =>
StringF.Format("{0}/", Suite, string.Empty) + Name;
F.Format("{0}/", Suite, string.Empty) + Name;

/// <summary>
/// Application Version.
Expand Down
6 changes: 2 additions & 4 deletions src/Jeebs/Extensions/String/StringExtensions.FormatWith.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
// Jeebs Rapid Application Development
// Copyright (c) bfren - licensed under https://mit.bfren.dev/2013

using Jeebs.Functions;

namespace Jeebs;

public static partial class StringExtensions
{
/// <inheritdoc cref="StringF.Format{T}(string, T)"/>
/// <inheritdoc cref="F.Format{T}(string, T)"/>
public static string FormatWith<T>(this string @this, T source) =>
Modify(@this, () => StringF.Format(@this, source));
Modify(@this, () => F.Format(@this, source));
}
105 changes: 0 additions & 105 deletions src/Jeebs/Functions/String/StringF.Format.cs

This file was deleted.

9 changes: 0 additions & 9 deletions src/Jeebs/Functions/StringF.cs

This file was deleted.

3 changes: 3 additions & 0 deletions tests/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ dotnet_diagnostic.IDE0053.severity = none
# IDE0058: Expression value is never used
dotnet_diagnostic.IDE0058.severity = none

# IDE0290: Use primary constructor
dotnet_diagnostic.IDE0290.severity = none

# IDE1006: Naming Styles
dotnet_diagnostic.IDE1006.severity = none

Expand Down
5 changes: 3 additions & 2 deletions tests/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
<Using Include="Xunit" />
</ItemGroup>
<ItemGroup>
<Using Include="Wrap.Testing.IdGenerator" Alias="IdGen" />
<Using Include="Wrap.Testing.FailureGenerator" Alias="FailGen" />
<Using Include="Wrap.Testing.IdGenerator" Alias="IdGen" />
<Using Include="Wrap.Testing.NoneGenerator" Alias="NoneGen" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="coverlet.collector">
Expand All @@ -38,4 +39,4 @@
</PackageReference>
<PackageReference Include="xunit.v3" />
</ItemGroup>
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ public void Other_Throws_UnrecognisedSearchOperatorException(int input)
var value = (Compare)input;

// Act
var action = void () => value.ToOperator();
var result = Record.Exception(() => value.ToOperator());

// Assert
Assert.Throws<UnrecognisedSearchOperatorException>(action);
Assert.IsType<UnrecognisedSearchOperatorException>(result);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ public void With_Parts_Adds_Limit()
{
// Arrange
var (client, v) = MySqlDbClient_Setup.Get();
var max = Rnd.ULng;
var max = Rnd.UInt64;
var parts = new QueryParts(v.Table) { Maximum = max };
var expected = $"SELECT * FROM `{v.Schema}.{v.Name}` LIMIT {max};";

Expand All @@ -402,8 +402,8 @@ public void With_Parts_Adds_Limit_And_Offset()
{
// Arrange
var (client, v) = MySqlDbClient_Setup.Get();
var skip = Rnd.ULng;
var max = Rnd.ULng;
var skip = Rnd.UInt64;
var max = Rnd.UInt64;
var parts = new QueryParts(v.Table) { Skip = skip, Maximum = max };
var expected = $"SELECT * FROM `{v.Schema}.{v.Name}` LIMIT {skip}, {max};";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ public void Null_Or_Whitespace_Throws_JsonException(string input)
var handler = new JsonbTypeHandler<Test>();

// Act
var action = void () => handler.Parse(input);
var result = Record.Exception(() => handler.Parse(input));

// Assert
Assert.Throws<JsonException>(action);
Assert.IsType<JsonException>(result);
}

[Fact]
Expand All @@ -32,10 +32,10 @@ public void InvalidJson_Throws_JsonException()
var input = Rnd.Str;

// Act
var action = void () => handler.Parse(input);
var result = Record.Exception(() => handler.Parse(input));

// Assert
var ex = Assert.Throws<FailureException>(action);
var ex = Assert.IsType<FailureException>(result);
Assert.IsType<JsonException>(ex.InnerException);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ public void Other_Throws_UnrecognisedSearchOperatorException(int input)
var value = (Compare)input;

// Act
var action = void () => value.ToOperator();
var result = Record.Exception(() => value.ToOperator());

// Assert
Assert.Throws<UnrecognisedSearchOperatorException>(action);
Assert.IsType<UnrecognisedSearchOperatorException>(result);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ public void With_Parts_Adds_Limit()
{
// Arrange
var (client, v) = PostgreSqlDbClient_Setup.Get();
var max = Rnd.ULng;
var max = Rnd.UInt64;
var parts = new QueryParts(v.Table) { Maximum = max };
var expected = $"SELECT * FROM {v.Schema}.{v.Name} LIMIT {max};";

Expand All @@ -402,8 +402,8 @@ public void With_Parts_Adds_Limit_And_Offset()
{
// Arrange
var (client, v) = PostgreSqlDbClient_Setup.Get();
var skip = Rnd.ULng;
var max = Rnd.ULng;
var skip = Rnd.UInt64;
var max = Rnd.UInt64;
var parts = new QueryParts(v.Table) { Skip = skip, Maximum = max };
var expected = $"SELECT * FROM {v.Schema}.{v.Name} LIMIT {max} OFFSET {skip};";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ public void Other_Throws_UnrecognisedSearchOperatorException(int input)
var value = (Compare)input;

// Act
var action = void () => value.ToOperator();
var result = Record.Exception(() => value.ToOperator());

// Assert
Assert.Throws<UnrecognisedSearchOperatorException>(action);
Assert.IsType<UnrecognisedSearchOperatorException>(result);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ public void With_Parts_Adds_Limit()
{
// Arrange
var (client, v) = SqlServerDbClient_Setup.Get();
var max = Rnd.ULng;
var max = Rnd.UInt64;
var parts = new QueryParts(v.Table) { Maximum = max };
var expected = $"SELECT * FROM [{v.Schema}].[{v.Name}] OFFSET 0 ROWS FETCH NEXT {max} ROWS ONLY";

Expand All @@ -402,8 +402,8 @@ public void With_Parts_Adds_Limit_And_Offset()
{
// Arrange
var (client, v) = SqlServerDbClient_Setup.Get();
var skip = Rnd.ULng;
var max = Rnd.ULng;
var skip = Rnd.UInt64;
var max = Rnd.UInt64;
var parts = new QueryParts(v.Table) { Skip = skip, Maximum = max };
var expected = $"SELECT * FROM [{v.Schema}].[{v.Name}] OFFSET {skip} ROWS FETCH NEXT {max} ROWS ONLY";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ public void Other_Throws_UnrecognisedSearchOperatorException(int input)
var value = (Compare)input;

// Act
var action = void () => value.ToOperator();
var result = Record.Exception(() => value.ToOperator());

// Assert
Assert.Throws<UnrecognisedSearchOperatorException>(action);
Assert.IsType<UnrecognisedSearchOperatorException>(result);
}
}
Loading