提交 4d75b982 编写于 作者: N Nick Craver

Tests: make analyzers happy because why not

上级 b5b65e60
......@@ -469,7 +469,7 @@ public void InsertWithCustomTableNameMapper()
var name = type.Name + "s";
if (type.IsInterface() && name.StartsWith("I"))
name = name.Substring(1);
return name.Substring(1);
return name;
}
};
......
......@@ -8,6 +8,7 @@
using System.Linq;
using System.Text;
#pragma warning disable RCS1141 // Add parameter to documentation comment.
namespace Massive
{
public static class ObjectExtensions
......@@ -115,7 +116,9 @@ public class DynamicModel
{
private readonly DbProviderFactory _factory;
#pragma warning disable 0649
#pragma warning disable RCS1169 // Mark field as read-only.
private string _connectionString;
#pragma warning restore RCS1169 // Mark field as read-only.
#pragma warning restore 0649
public DynamicModel(string connectionStringName = "", string tableName = "", string primaryKeyField = "")
......@@ -450,4 +453,5 @@ public virtual dynamic Single(object key, string columns = "*")
}
}
}
#pragma warning restore RCS1141 // Add parameter to documentation comment.
#endif
\ No newline at end of file
......@@ -51,7 +51,7 @@ public void Add(Action<int> iteration, string name)
Add(new Test(iteration, name));
}
public void AddAsync(Func<int, Task> iterationAsync, string name)
public void AsyncAdd(Func<int, Task> iterationAsync, string name)
{
Add(new Test(iterationAsync, name));
}
......@@ -230,7 +230,7 @@ public async Task RunAsync(int iterations)
Try(() =>
{
var query = new Belgrade.SqlClient.SqlDb.QueryMapper(ConnectionString);
tests.AddAsync(id => query.ExecuteReader("SELECT TOP 1 * FROM Posts WHERE Id = " + id,
tests.AsyncAdd(id => query.ExecuteReader("SELECT TOP 1 * FROM Posts WHERE Id = " + id,
reader =>
{
var post = new Post();
......
......@@ -10,6 +10,7 @@
using System.Reflection;
using System.Reflection.Emit;
#pragma warning disable RCS1023 // Format empty block.
namespace PetaPoco
{
// Poco's marked [Explicit] require all column properties to be marked
......@@ -37,8 +38,8 @@ public class Column : Attribute
public class ResultColumn : Column
{
public ResultColumn() { }
public ResultColumn(string name) : base(name) { }
}
public ResultColumn(string name) : base(name) { }
}
// Specify the table name of a poco
[AttributeUsage(AttributeTargets.Class)]
......@@ -1287,7 +1288,7 @@ public void Dispose()
_db.CloseSharedConnection();
}
}
// Member variables
private readonly string _connectionString;
private readonly string _providerName;
......@@ -1441,4 +1442,5 @@ public void Build(StringBuilder sb, List<object> args, Sql lhs)
}
}
}
#pragma warning restore RCS1023 // Format empty block.
#endif
\ No newline at end of file
......@@ -9,6 +9,6 @@ internal class SomaConfig : MsSqlConfig
public override Action<PreparedStatement> Logger => noOp;
private static readonly Action<PreparedStatement> noOp = x => { };
private static readonly Action<PreparedStatement> noOp = x => { /* nope */ };
}
}
......@@ -791,7 +791,7 @@ public async Task Issue563_QueryAsyncShouldThrowException()
var data = (await connection.QueryAsync<int>("select 1 union all select 2; RAISERROR('after select', 16, 1);").ConfigureAwait(false)).ToList();
Assert.Fail();
}
catch (SqlException ex) when (ex.Message == "after select") { }
catch (SqlException ex) when (ex.Message == "after select") { /* swallow only this */ }
}
}
}
\ No newline at end of file
......@@ -90,7 +90,7 @@ private class _ExplicitConstructors
private readonly bool WentThroughProperConstructor;
public _ExplicitConstructors() { }
public _ExplicitConstructors() { /* yep */ }
[ExplicitConstructor]
public _ExplicitConstructors(string foo, int bar)
......
......@@ -471,7 +471,9 @@ private class TestFieldCaseAndPrivatesEntity
private int b { get; set; }
public int GetB() { return b; }
public int c = 0;
#pragma warning disable RCS1169 // Mark field as read-only.
private int d = 0;
#pragma warning restore RCS1169 // Mark field as read-only.
public int GetD() { return d; }
public int e { get; set; }
private string f
......
......@@ -176,7 +176,7 @@ static FactMySqlAttribute()
{
try
{
using (GetMySqlConnection(true)) { }
using (GetMySqlConnection(true)) { /* just trying to see if it works */ }
}
catch (Exception ex)
{
......
......@@ -71,7 +71,7 @@ static FactPostgresqlAttribute()
{
try
{
using (GetOpenNpgsqlConnection()) { }
using (GetOpenNpgsqlConnection()) { /* just trying to see if it works */ }
}
catch (Exception ex)
{
......
......@@ -69,7 +69,7 @@ public void Issue136_ValueTypeHandlers()
public class LocalDateHandler : SqlMapper.TypeHandler<LocalDate>
{
private LocalDateHandler() { }
private LocalDateHandler() { /* private constructor */ }
// Make the field type ITypeHandler to ensure it cannot be used with SqlMapper.AddTypeHandler<T>(TypeHandler<T>)
// by mistake.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册