Remove trailing whitespace

This commit is contained in:
ta264 2019-12-22 21:24:11 +00:00 committed by Qstick
parent 8d27111f7b
commit d4fa9b7345
273 changed files with 566 additions and 555 deletions

View File

@ -5,7 +5,7 @@ using System.Reflection;
using System.Resources; using System.Resources;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyCompany("Microsoft Open Technologies, Inc.")] [assembly: AssemblyCompany("Microsoft Open Technologies, Inc.")]

View File

@ -1,12 +1,12 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.md in the project root for license information. // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.md in the project root for license information.
// This file is used by Code Analysis to maintain SuppressMessage // This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project. // attributes that are applied to this project.
// Project-level suppressions either have no target or are given // Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc. // a specific target and scoped to a namespace, type, member, etc.
// //
// To add a suppression to this file, right-click the message in the // To add a suppression to this file, right-click the message in the
// Code Analysis results, point to "Suppress Message", and click // Code Analysis results, point to "Suppress Message", and click
// "In Suppression File". // "In Suppression File".
// You do not need to add suppressions to this file manually. // You do not need to add suppressions to this file manually.

View File

@ -1,7 +1,8 @@
<Project> <Project>
<!-- Common to all Radarr Projects --> <!-- Common to all Radarr Projects -->
<PropertyGroup> <PropertyGroup>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> <CodeAnalysisRuleSet>$(SolutionDir)Stylecop.ruleset</CodeAnalysisRuleSet>
<!-- <TreatWarningsAsErrors>true</TreatWarningsAsErrors> -->
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch> <TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
@ -92,6 +93,16 @@
</PackageReference> </PackageReference>
</ItemGroup> </ItemGroup>
<!-- Set up stylecop -->
<ItemGroup Condition="'$(RadarrProject)'=='true' and '$(RadarrOutputType)'!='Test'">
<!-- StyleCop analysis -->
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<AdditionalFiles Include="$(SolutionDir)stylecop.json" />
</ItemGroup>
<!-- <!--
Set runtime identifier to local system type if not specified Set runtime identifier to local system type if not specified
--> -->

View File

@ -27,14 +27,14 @@ namespace Marr.Data
/// </summary> /// </summary>
internal static class DataHelper internal static class DataHelper
{ {
public static bool HasColumn(this IDataReader dr, string columnName) public static bool HasColumn(this IDataReader dr, string columnName)
{ {
for (int i=0; i < dr.FieldCount; i++) for (int i=0; i < dr.FieldCount; i++)
{ {
if (dr.GetName(i).Equals(columnName, StringComparison.InvariantCultureIgnoreCase)) if (dr.GetName(i).Equals(columnName, StringComparison.InvariantCultureIgnoreCase))
return true; return true;
} }
return false; return false;
} }
public static string ParameterPrefix(this IDbCommand command) public static string ParameterPrefix(this IDbCommand command)
@ -42,7 +42,7 @@ namespace Marr.Data
string commandType = command.GetType().Name.ToLower(); string commandType = command.GetType().Name.ToLower();
return commandType.Contains("oracle") ? ":" : "@"; return commandType.Contains("oracle") ? ":" : "@";
} }
/// <summary> /// <summary>
/// Returns the mapped name, or the member name. /// Returns the mapped name, or the member name.
/// </summary> /// </summary>

View File

@ -131,8 +131,8 @@ namespace Marr.Data
#region - SP / SQL Mode - #region - SP / SQL Mode -
/// <summary> /// <summary>
/// Gets or sets a value that determines whether the DataMapper will /// Gets or sets a value that determines whether the DataMapper will
/// use a stored procedure or a sql text command to access /// use a stored procedure or a sql text command to access
/// the database. The default is stored procedure. /// the database. The default is stored procedure.
/// </summary> /// </summary>
public SqlModes SqlMode { get; set; } public SqlModes SqlMode { get; set; }
@ -617,7 +617,7 @@ namespace Marr.Data
{ {
while (reader.Read()) while (reader.Read())
{ {
// The entire EntityGraph is traversed for each record, // The entire EntityGraph is traversed for each record,
// and multiple entities are created from each view record. // and multiple entities are created from each view record.
foreach (EntityGraph lvl in graph) foreach (EntityGraph lvl in graph)
{ {

View File

@ -238,14 +238,14 @@ namespace Marr.Data
} }
/// <summary> /// <summary>
/// Gets the GroupingKeys for this entity. /// Gets the GroupingKeys for this entity.
/// GroupingKeys determine when to create and add a new entity to the graph. /// GroupingKeys determine when to create and add a new entity to the graph.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// A simple entity with no relationships will return only its PrimaryKey columns. /// A simple entity with no relationships will return only its PrimaryKey columns.
/// A parent entity with one-to-one child relationships will include its own PrimaryKeys, /// A parent entity with one-to-one child relationships will include its own PrimaryKeys,
/// and it will recursively traverse all Children with one-to-one relationships and add their PrimaryKeys. /// and it will recursively traverse all Children with one-to-one relationships and add their PrimaryKeys.
/// A child entity that has a one-to-one relationship with its parent will use the same /// A child entity that has a one-to-one relationship with its parent will use the same
/// GroupingKeys already defined by its parent. /// GroupingKeys already defined by its parent.
/// </remarks> /// </remarks>
public GroupingKeyCollection GroupingKeyColumns public GroupingKeyCollection GroupingKeyColumns

View File

@ -32,11 +32,11 @@ namespace Marr.Data
DbCommand Command { get; } DbCommand Command { get; }
/// <summary> /// <summary>
/// Gets or sets a value that determines whether the DataMapper will /// Gets or sets a value that determines whether the DataMapper will
/// use a stored procedure or a sql text command to access /// use a stored procedure or a sql text command to access
/// the database. The default is stored procedure. /// the database. The default is stored procedure.
/// </summary> /// </summary>
SqlModes SqlMode { get; set; } SqlModes SqlMode { get; set; }
#endregion #endregion

View File

@ -181,10 +181,10 @@ namespace Marr.Data
/// <summary> /// <summary>
/// Gets or sets the reflection strategy that the DataMapper will use to load entities. /// Gets or sets the reflection strategy that the DataMapper will use to load entities.
/// By default the CachedReflector will be used, which provides a performance increase over the SimpleReflector. /// By default the CachedReflector will be used, which provides a performance increase over the SimpleReflector.
/// However, the SimpleReflector can be used in Medium Trust enviroments. /// However, the SimpleReflector can be used in Medium Trust enviroments.
/// </summary> /// </summary>
/// ///
public IReflectionStrategy ReflectionStrategy { get; set; } public IReflectionStrategy ReflectionStrategy { get; set; }
#endregion #endregion
@ -236,7 +236,7 @@ namespace Marr.Data
/// <summary> /// <summary>
/// Gets or sets the IDBTypeBuilder that is responsible for converting parameter DbTypes based on the parameter value. /// Gets or sets the IDBTypeBuilder that is responsible for converting parameter DbTypes based on the parameter value.
/// Defaults to use the DbTypeBuilder. /// Defaults to use the DbTypeBuilder.
/// You can replace this with a more specific builder if you want more control over the way the parameter types are set. /// You can replace this with a more specific builder if you want more control over the way the parameter types are set.
/// </summary> /// </summary>
public IDbTypeBuilder DbTypeBuilder public IDbTypeBuilder DbTypeBuilder

View File

@ -198,7 +198,7 @@ namespace Marr.Data.Mapping
} }
/// <summary> /// <summary>
/// Tries to add a ColumnMap for the given field name. /// Tries to add a ColumnMap for the given field name.
/// Throws and exception if field cannot be found. /// Throws and exception if field cannot be found.
/// </summary> /// </summary>
private void TryAddColumnMapForField(string fieldName) private void TryAddColumnMapForField(string fieldName)

View File

@ -99,7 +99,7 @@ namespace Marr.Data.Mapping
} }
/// <summary> /// <summary>
/// Parses and orders the parameters from the query text. /// Parses and orders the parameters from the query text.
/// Filters the list of mapped columns to match the parameters found in the sql query. /// Filters the list of mapped columns to match the parameters found in the sql query.
/// All parameters starting with the '@' or ':' symbol are matched and returned. /// All parameters starting with the '@' or ':' symbol are matched and returned.
/// </summary> /// </summary>
@ -139,7 +139,7 @@ namespace Marr.Data.Mapping
/// <summary> /// <summary>
/// Set's each column's altname as the given prefix + the column name. /// Set's each column's altname as the given prefix + the column name.
/// Ex: /// Ex:
/// Original column name: "ID" /// Original column name: "ID"
/// Passed in prefix: "PRODUCT_" /// Passed in prefix: "PRODUCT_"
/// Generated AltName: "PRODUCT_ID" /// Generated AltName: "PRODUCT_ID"
@ -154,7 +154,7 @@ namespace Marr.Data.Mapping
/// <summary> /// <summary>
/// Set's each column's altname as the column name + the given prefix. /// Set's each column's altname as the column name + the given prefix.
/// Ex: /// Ex:
/// Original column name: "ID" /// Original column name: "ID"
/// Passed in suffix: "_PRODUCT" /// Passed in suffix: "_PRODUCT"
/// Generated AltName: "ID_PRODUCT" /// Generated AltName: "ID_PRODUCT"

View File

@ -19,7 +19,7 @@ namespace Marr.Data.Mapping
public FluentMappings(bool publicOnly) public FluentMappings(bool publicOnly)
{ {
_publicOnly = publicOnly; _publicOnly = publicOnly;
} }
public MappingsFluentEntity<TEntity> Entity<TEntity>() public MappingsFluentEntity<TEntity> Entity<TEntity>()
@ -77,7 +77,7 @@ namespace Marr.Data.Mapping
/// <summary> /// <summary>
/// Creates column mappings for the given type. /// Creates column mappings for the given type.
/// Maps all properties that are simple types (int, string, DateTime, etc). /// Maps all properties that are simple types (int, string, DateTime, etc).
/// ICollection properties are not included. /// ICollection properties are not included.
/// </summary> /// </summary>
/// <typeparam name="T">The type that is being built.</typeparam> /// <typeparam name="T">The type that is being built.</typeparam>

View File

@ -28,5 +28,5 @@ namespace Marr.Data.Mapping
ParameterDirection ParamDirection { get; set; } ParameterDirection ParamDirection { get; set; }
string TryGetAltName(); string TryGetAltName();
} }
} }

View File

@ -36,7 +36,7 @@ namespace Marr.Data.Mapping
/// <summary> /// <summary>
/// Creates column mappings for the given type. /// Creates column mappings for the given type.
/// Maps all properties that are simple types (int, string, DateTime, etc). /// Maps all properties that are simple types (int, string, DateTime, etc).
/// ICollection properties are not included. /// ICollection properties are not included.
/// </summary> /// </summary>
/// <typeparam name="T">The type that is being built.</typeparam> /// <typeparam name="T">The type that is being built.</typeparam>
@ -49,7 +49,7 @@ namespace Marr.Data.Mapping
} }
/// <summary> /// <summary>
/// Creates column mappings for the given type. /// Creates column mappings for the given type.
/// Maps properties that are included in the include list. /// Maps properties that are included in the include list.
/// </summary> /// </summary>
/// <typeparam name="T">The type that is being built.</typeparam> /// <typeparam name="T">The type that is being built.</typeparam>
@ -71,7 +71,7 @@ namespace Marr.Data.Mapping
/// <returns><see cref="ColumnMapCollection"/></returns> /// <returns><see cref="ColumnMapCollection"/></returns>
public ColumnMapBuilder<T> BuildColumnsExcept<T>(params string[] propertiesToExclude) public ColumnMapBuilder<T> BuildColumnsExcept<T>(params string[] propertiesToExclude)
{ {
return BuildColumns<T>(m => return BuildColumns<T>(m =>
m.MemberType == MemberTypes.Property && m.MemberType == MemberTypes.Property &&
!propertiesToExclude.Contains(m.Name)); !propertiesToExclude.Contains(m.Name));
} }
@ -105,7 +105,7 @@ namespace Marr.Data.Mapping
MapRepository.Instance.Columns[entityType] = columns; MapRepository.Instance.Columns[entityType] = columns;
return new ColumnMapBuilder<T>(null, columns); return new ColumnMapBuilder<T>(null, columns);
} }
#endregion #endregion
#region - Relationships - #region - Relationships -
@ -118,8 +118,8 @@ namespace Marr.Data.Mapping
/// <returns><see cref="RelationshipBuilder"/></returns> /// <returns><see cref="RelationshipBuilder"/></returns>
public RelationshipBuilder<T> BuildRelationships<T>() public RelationshipBuilder<T> BuildRelationships<T>()
{ {
return BuildRelationships<T>(m => return BuildRelationships<T>(m =>
m.MemberType == MemberTypes.Property && m.MemberType == MemberTypes.Property &&
typeof(ICollection).IsAssignableFrom((m as PropertyInfo).PropertyType)); typeof(ICollection).IsAssignableFrom((m as PropertyInfo).PropertyType));
} }
@ -132,10 +132,10 @@ namespace Marr.Data.Mapping
/// <returns><see cref="RelationshipBuilder"/></returns> /// <returns><see cref="RelationshipBuilder"/></returns>
public RelationshipBuilder<T> BuildRelationships<T>(params string[] propertiesToInclude) public RelationshipBuilder<T> BuildRelationships<T>(params string[] propertiesToInclude)
{ {
Func<MemberInfo, bool> predicate = m => Func<MemberInfo, bool> predicate = m =>
( (
// ICollection properties // ICollection properties
m.MemberType == MemberTypes.Property && m.MemberType == MemberTypes.Property &&
typeof(ICollection).IsAssignableFrom((m as PropertyInfo).PropertyType) && typeof(ICollection).IsAssignableFrom((m as PropertyInfo).PropertyType) &&
propertiesToInclude.Contains(m.Name) propertiesToInclude.Contains(m.Name)
) || ( // Single entity properties ) || ( // Single entity properties
@ -143,7 +143,7 @@ namespace Marr.Data.Mapping
!typeof(ICollection).IsAssignableFrom((m as PropertyInfo).PropertyType) && !typeof(ICollection).IsAssignableFrom((m as PropertyInfo).PropertyType) &&
propertiesToInclude.Contains(m.Name) propertiesToInclude.Contains(m.Name)
); );
return BuildRelationships<T>(predicate); return BuildRelationships<T>(predicate);
} }
@ -176,7 +176,7 @@ namespace Marr.Data.Mapping
MapRepository.Instance.Relationships[entityType] = relationships; MapRepository.Instance.Relationships[entityType] = relationships;
return new RelationshipBuilder<T>(null, relationships); return new RelationshipBuilder<T>(null, relationships);
} }
#endregion #endregion
#region - Tables - #region - Tables -

View File

@ -135,7 +135,7 @@ namespace Marr.Data.Mapping
} }
/// <summary> /// <summary>
/// Tries to add a Relationship for the given field name. /// Tries to add a Relationship for the given field name.
/// Throws and exception if field cannot be found. /// Throws and exception if field cannot be found.
/// </summary> /// </summary>
private void TryAddRelationshipForField(string fieldName) private void TryAddRelationshipForField(string fieldName)

View File

@ -23,9 +23,9 @@ namespace Marr.Data.Mapping.Strategies
} }
public Func<MemberInfo, bool> ColumnPredicate; public Func<MemberInfo, bool> ColumnPredicate;
public Func<MemberInfo, bool> RelationshipPredicate; public Func<MemberInfo, bool> RelationshipPredicate;
protected override void CreateColumnMap(Type entityType, MemberInfo member, ColumnAttribute columnAtt, ColumnMapCollection columnMaps) protected override void CreateColumnMap(Type entityType, MemberInfo member, ColumnAttribute columnAtt, ColumnMapCollection columnMaps)
{ {

View File

@ -20,7 +20,7 @@ using System.Reflection;
namespace Marr.Data.Mapping.Strategies namespace Marr.Data.Mapping.Strategies
{ {
/// <summary> /// <summary>
/// Maps all public properties to DB columns. /// Maps all public properties to DB columns.
/// </summary> /// </summary>
public class PropertyMapStrategy : AttributeMapStrategy public class PropertyMapStrategy : AttributeMapStrategy
{ {

View File

@ -87,7 +87,7 @@ namespace Marr.Data.Mapping.Strategies
ColumnAttribute columnAtt = GetColumnAttribute(member); ColumnAttribute columnAtt = GetColumnAttribute(member);
CreateColumnMap(entityType, member, columnAtt, columnMaps); CreateColumnMap(entityType, member, columnAtt, columnMaps);
} }
return columnMaps; return columnMaps;
} }
@ -124,7 +124,7 @@ namespace Marr.Data.Mapping.Strategies
return null; return null;
} }
/// <summary> /// <summary>
/// Inspect a member and optionally add a ColumnMap. /// Inspect a member and optionally add a ColumnMap.
/// </summary> /// </summary>

View File

@ -19,7 +19,7 @@ using System.Data;
namespace Marr.Data.Parameters namespace Marr.Data.Parameters
{ {
/// <summary> /// <summary>
/// Converts from a .NET datatype to the appropriate DB type enum, /// Converts from a .NET datatype to the appropriate DB type enum,
/// and then adds the value to the appropriate property on the parameter. /// and then adds the value to the appropriate property on the parameter.
/// </summary> /// </summary>
public interface IDbTypeBuilder public interface IDbTypeBuilder

View File

@ -37,7 +37,7 @@ namespace Marr.Data.Parameters
Parameter.ParameterName = parameterName; Parameter.ParameterName = parameterName;
// Convert null to DBNull.Value // Convert null to DBNull.Value
if (value == null) if (value == null)
value = DBNull.Value; value = DBNull.Value;
Type valueType = value.GetType(); Type valueType = value.GetType();
@ -59,9 +59,9 @@ namespace Marr.Data.Parameters
else else
{ {
Parameter.Value = value; Parameter.Value = value;
} }
} }
//// Determine the correct DbType based on the passed in value type //// Determine the correct DbType based on the passed in value type
//IDbTypeBuilder typeBuilder = MapRepository.Instance.DbTypeBuilder; //IDbTypeBuilder typeBuilder = MapRepository.Instance.DbTypeBuilder;
@ -122,7 +122,7 @@ namespace Marr.Data.Parameters
Parameter.Scale = scale; Parameter.Scale = scale;
return this; return this;
} }
public ParameterChainMethods Name(string name) public ParameterChainMethods Name(string name)
{ {
Parameter.ParameterName = name; Parameter.ParameterName = name;

View File

@ -21,7 +21,7 @@ namespace Marr.Data.QGen
public string Generate() public string Generate()
{ {
return string.Format("DELETE FROM {0} {1} ", return string.Format("DELETE FROM {0} {1} ",
Dialect.CreateToken(TargetTable.Name), Dialect.CreateToken(TargetTable.Name),
WhereClause); WhereClause);
} }
} }

View File

@ -8,7 +8,7 @@ using System.Linq.Expressions;
namespace Marr.Data.QGen namespace Marr.Data.QGen
{ {
///<summary> ///<summary>
/// Expression visitor /// Expression visitor
///</summary> ///</summary>
public class ExpressionVisitor public class ExpressionVisitor
{ {

View File

@ -157,7 +157,7 @@ namespace Marr.Data.QGen
_db.CloseConnection(); _db.CloseConnection();
} }
if (_generateQuery) if (_generateQuery)
{ {
// Return to previous sql mode // Return to previous sql mode

View File

@ -6,7 +6,7 @@ using System.Linq.Expressions;
namespace Marr.Data.QGen namespace Marr.Data.QGen
{ {
/// <summary> /// <summary>
/// This class overrides the WhereBuilder which utilizes the ExpressionVisitor base class, /// This class overrides the WhereBuilder which utilizes the ExpressionVisitor base class,
/// and it is responsible for translating the lambda expression into a "JOIN ON" clause. /// and it is responsible for translating the lambda expression into a "JOIN ON" clause.
/// It populates the protected string builder, which outputs the "JOIN ON" clause when the ToString method is called. /// It populates the protected string builder, which outputs the "JOIN ON" clause when the ToString method is called.
/// </summary> /// </summary>

View File

@ -27,7 +27,7 @@ namespace Marr.Data.QGen
public string Generate() public string Generate()
{ {
// Decide which type of paging query to create // Decide which type of paging query to create
if (_innerQuery.IsView || _innerQuery.IsJoin) if (_innerQuery.IsView || _innerQuery.IsJoin)
{ {
return ComplexPaging(); return ComplexPaging();
@ -56,7 +56,7 @@ namespace Marr.Data.QGen
return sql.ToString(); return sql.ToString();
} }
/// <summary> /// <summary>
/// Generates a query that pages a view or joined inner query. /// Generates a query that pages a view or joined inner query.
/// </summary> /// </summary>
@ -165,7 +165,7 @@ namespace Marr.Data.QGen
{ {
orderBy = orderBy.Replace(string.Format("[{0}].", t.Alias), ""); orderBy = orderBy.Replace(string.Format("[{0}].", t.Alias), "");
} }
sql.AppendFormat(", ROW_NUMBER() OVER ({0}) As RowNumber ", orderBy); sql.AppendFormat(", ROW_NUMBER() OVER ({0}) As RowNumber ", orderBy);
} }

View File

@ -190,7 +190,7 @@ namespace Marr.Data.QGen
_isGraph = true; _isGraph = true;
return this; return this;
} }
public virtual QueryBuilder<T> Page(int pageNumber, int pageSize) public virtual QueryBuilder<T> Page(int pageNumber, int pageSize)
{ {
_enablePaging = true; _enablePaging = true;
@ -198,7 +198,7 @@ namespace Marr.Data.QGen
_take = pageSize; _take = pageSize;
return this; return this;
} }
private string[] ParseChildrenToLoad(Expression<Func<T, object>>[] childrenToLoad) private string[] ParseChildrenToLoad(Expression<Func<T, object>>[] childrenToLoad)
{ {
List<string> entitiesToLoad = new List<string>(); List<string> entitiesToLoad = new List<string>();
@ -208,7 +208,7 @@ namespace Marr.Data.QGen
{ {
MemberInfo member = (exp.Body as MemberExpression).Member; MemberInfo member = (exp.Body as MemberExpression).Member;
entitiesToLoad.Add(member.Name); entitiesToLoad.Add(member.Name);
} }
return entitiesToLoad.ToArray(); return entitiesToLoad.ToArray();

View File

@ -16,7 +16,7 @@ namespace Marr.Data.QGen
private const string DB_OracleDataAccessClient = "Oracle.DataAccess.Client.OracleClientFactory"; private const string DB_OracleDataAccessClient = "Oracle.DataAccess.Client.OracleClientFactory";
private const string DB_FireBirdClient = "FirebirdSql.Data.FirebirdClient.FirebirdClientFactory"; private const string DB_FireBirdClient = "FirebirdSql.Data.FirebirdClient.FirebirdClientFactory";
private const string DB_SQLiteClient = "System.Data.SQLite.SQLiteFactory"; private const string DB_SQLiteClient = "System.Data.SQLite.SQLiteFactory";
public static IQuery CreateUpdateQuery(ColumnMapCollection columns, IDataMapper dataMapper, string target, string whereClause) public static IQuery CreateUpdateQuery(ColumnMapCollection columns, IDataMapper dataMapper, string target, string whereClause)
{ {
Dialect dialect = CreateDialect(dataMapper); Dialect dialect = CreateDialect(dataMapper);

View File

@ -10,7 +10,7 @@ namespace Marr.Data.QGen
{ {
_innerQuery = innerQuery; _innerQuery = innerQuery;
} }
public string Generate() public string Generate()
{ {
// Decide which type of paging query to create // Decide which type of paging query to create
@ -108,12 +108,12 @@ namespace Marr.Data.QGen
} }
/* /*
WITH GroupCTE AS WITH GroupCTE AS
( (
SELECT [t0].[ID],[t0].[OrderName],[t1].[ID] AS OrderItemID,[t1].[OrderID],[t1].[ItemDescription],[t1].[Price], SELECT [t0].[ID],[t0].[OrderName],[t1].[ID] AS OrderItemID,[t1].[OrderID],[t1].[ItemDescription],[t1].[Price],
ROW_NUMBER() OVER (PARTITION BY [t0].[ID] ORDER BY [t0].[OrderName]) As GroupRow ROW_NUMBER() OVER (PARTITION BY [t0].[ID] ORDER BY [t0].[OrderName]) As GroupRow
FROM [Order] [t0] FROM [Order] [t0]
LEFT JOIN [OrderItem] [t1] ON (([t0].[ID] = [t1].[OrderID])) LEFT JOIN [OrderItem] [t1] ON (([t0].[ID] = [t1].[OrderID]))
--WHERE (([t0].[OrderName] = @P0)) --WHERE (([t0].[OrderName] = @P0))
) )
SELECT * FROM GroupCTE SELECT * FROM GroupCTE

View File

@ -131,7 +131,7 @@ namespace Marr.Data.QGen
{ {
sql.Append(OrderBy.ToString()); sql.Append(OrderBy.ToString());
} }
public void BuildGroupBy(StringBuilder sql) public void BuildGroupBy(StringBuilder sql)
{ {
var baseTable = this.Tables.First(); var baseTable = this.Tables.First();

View File

@ -85,7 +85,7 @@ namespace Marr.Data.QGen
_sortExpressions.Add(new SortColumn<T>(declaringType, propertyName, SortDirection.Desc)); _sortExpressions.Add(new SortColumn<T>(declaringType, propertyName, SortDirection.Desc));
return this; return this;
} }
public virtual SortBuilder<T> OrderBy(string orderByClause) public virtual SortBuilder<T> OrderBy(string orderByClause)
{ {
if (string.IsNullOrEmpty(orderByClause)) if (string.IsNullOrEmpty(orderByClause))

View File

@ -37,7 +37,7 @@ namespace Marr.Data.QGen
return me; return me;
} }
} }
public enum SortDirection public enum SortDirection
{ {
Asc, Asc,

View File

@ -10,11 +10,11 @@ namespace Marr.Data.QGen
{ {
_innerQuery = innerQuery; _innerQuery = innerQuery;
} }
public string Generate() public string Generate()
{ {
StringBuilder sql = new StringBuilder(); StringBuilder sql = new StringBuilder();
BuildSelectCountClause(sql); BuildSelectCountClause(sql);
if (_innerQuery.IsJoin) if (_innerQuery.IsJoin)
@ -29,7 +29,7 @@ namespace Marr.Data.QGen
return sql.ToString(); return sql.ToString();
} }
_innerQuery.BuildFromClause(sql); _innerQuery.BuildFromClause(sql);
_innerQuery.BuildJoinClauses(sql); _innerQuery.BuildJoinClauses(sql);
_innerQuery.BuildWhereClause(sql); _innerQuery.BuildWhereClause(sql);

View File

@ -155,7 +155,7 @@ namespace Marr.Data.QGen
{ {
_db.OpenConnection(); _db.OpenConnection();
rowsAffected = _db.Command.ExecuteNonQuery(); rowsAffected = _db.Command.ExecuteNonQuery();
_mappingHelper.SetOutputValues<T>(_entity, _mappings.OutputFields); _mappingHelper.SetOutputValues<T>(_entity, _mappings.OutputFields);
} }
finally finally
{ {

View File

@ -25,7 +25,7 @@ namespace Marr.Data.QGen
{ {
get { return _tables; } get { return _tables; }
} }
public override string Name public override string Name
{ {
get get

View File

@ -49,7 +49,7 @@ namespace Marr.Data.QGen
{ {
_sb.AppendFormat("{0} ", PrefixText); _sb.AppendFormat("{0} ", PrefixText);
base.Visit(filter); base.Visit(filter);
} }
} }
protected virtual string PrefixText protected virtual string PrefixText
@ -93,7 +93,7 @@ namespace Marr.Data.QGen
case "EndsWith": case "EndsWith":
Write_EndsWith(expression); Write_EndsWith(expression);
break; break;
case "In": case "In":
Write_In(expression); Write_In(expression);
break; break;
@ -148,14 +148,14 @@ namespace Marr.Data.QGen
private object GetRightValue(Expression expression) private object GetRightValue(Expression expression)
{ {
object rightValue = null; object rightValue = null;
var simpleConstExp = expression as ConstantExpression; var simpleConstExp = expression as ConstantExpression;
if (simpleConstExp == null) // Value is not directly passed in as a constant if (simpleConstExp == null) // Value is not directly passed in as a constant
{ {
MemberExpression memberExp = expression as MemberExpression; MemberExpression memberExp = expression as MemberExpression;
ConstantExpression constExp = null; ConstantExpression constExp = null;
// Value may be nested in multiple levels of objects/properties, so traverse the MemberExpressions // Value may be nested in multiple levels of objects/properties, so traverse the MemberExpressions
// until a ConstantExpression property value is found, and then unwind the stack to get the value. // until a ConstantExpression property value is found, and then unwind the stack to get the value.
var memberNames = new Stack<string>(); var memberNames = new Stack<string>();
@ -218,8 +218,8 @@ namespace Marr.Data.QGen
private string Decode(BinaryExpression expression) private string Decode(BinaryExpression expression)
{ {
bool isRightSideNullConstant = expression.Right.NodeType == bool isRightSideNullConstant = expression.Right.NodeType ==
ExpressionType.Constant && ExpressionType.Constant &&
((ConstantExpression)expression.Right).Value == null; ((ConstantExpression)expression.Right).Value == null;
if (isRightSideNullConstant) if (isRightSideNullConstant)
@ -315,7 +315,7 @@ namespace Marr.Data.QGen
} }
return _constantWhereClause; return _constantWhereClause;
} }
} }
internal enum WhereAppendType internal enum WhereAppendType
{ {

View File

@ -40,7 +40,7 @@ namespace Marr.Data.Reflection
} }
/// <summary> /// <summary>
/// Gets the CLR data type of a MemberInfo. /// Gets the CLR data type of a MemberInfo.
/// If the type is nullable, returns the underlying type. /// If the type is nullable, returns the underlying type.
/// </summary> /// </summary>
/// <param name="member"></param> /// <param name="member"></param>

View File

@ -7,7 +7,7 @@ namespace Marr.Data
/// <summary> /// <summary>
/// The UnitOfWork class can be used to manage the lifetime of an IDataMapper, from creation to disposal. /// The UnitOfWork class can be used to manage the lifetime of an IDataMapper, from creation to disposal.
/// When used in a "using" statement, the UnitOfWork will create and dispose an IDataMapper. /// When used in a "using" statement, the UnitOfWork will create and dispose an IDataMapper.
/// When the SharedContext property is used in a "using" statement, /// When the SharedContext property is used in a "using" statement,
/// it will create a parent unit of work that will share a single IDataMapper with other units of work, /// it will create a parent unit of work that will share a single IDataMapper with other units of work,
/// and the IDataMapper will not be disposed until the shared context is disposed. /// and the IDataMapper will not be disposed until the shared context is disposed.
/// If more than one shared context is created, the IDataMapper will be disposed when the outer most /// If more than one shared context is created, the IDataMapper will be disposed when the outer most

View File

@ -3,7 +3,7 @@
namespace Marr.Data namespace Marr.Data
{ {
/// <summary> /// <summary>
/// Works in conjunction with the UnitOfWork to create a new /// Works in conjunction with the UnitOfWork to create a new
/// shared context that will preserve a single IDataMapper. /// shared context that will preserve a single IDataMapper.
/// </summary> /// </summary>
public class UnitOfWorkSharedContext : IDisposable public class UnitOfWorkSharedContext : IDisposable

View File

@ -59,7 +59,7 @@ namespace MonoTorrent.BEncoding
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="reader"></param> /// <param name="reader"></param>
internal override void DecodeInternal(RawReader reader) internal override void DecodeInternal(RawReader reader)
@ -133,7 +133,7 @@ namespace MonoTorrent.BEncoding
} }
else else
value = BEncodedValue.Decode(reader); // the value is a BEncoded value value = BEncodedValue.Decode(reader); // the value is a BEncoded value
torrent.dictionary.Add(key, value); torrent.dictionary.Add(key, value);
} }

View File

@ -38,7 +38,7 @@ namespace MonoTorrent.BEncoding
{ {
if (list == null) if (list == null)
throw new ArgumentNullException("list"); throw new ArgumentNullException("list");
this.list = new List<BEncodedValue>(list); this.list = new List<BEncodedValue>(list);
} }

View File

@ -56,7 +56,7 @@ namespace MonoTorrent.BEncoding
int written = offset; int written = offset;
buffer[written++] = (byte)'i'; buffer[written++] = (byte)'i';
if (number < 0) if (number < 0)
{ {
buffer[written++] = (byte)'-'; buffer[written++] = (byte)'-';
@ -171,7 +171,7 @@ namespace MonoTorrent.BEncoding
#region Overridden Methods #region Overridden Methods
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="obj"></param> /// <param name="obj"></param>
/// <returns></returns> /// <returns></returns>
@ -185,7 +185,7 @@ namespace MonoTorrent.BEncoding
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public override int GetHashCode() public override int GetHashCode()
@ -194,7 +194,7 @@ namespace MonoTorrent.BEncoding
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public override string ToString() public override string ToString()

View File

@ -87,7 +87,7 @@ namespace MonoTorrent.BEncoding
/// <summary> /// <summary>
/// Decode BEncoded data in the given stream /// Decode BEncoded data in the given stream
/// </summary> /// </summary>
/// <param name="stream">The stream containing the BEncoded data</param> /// <param name="stream">The stream containing the BEncoded data</param>
/// <returns>BEncodedValue containing the data that was in the stream</returns> /// <returns>BEncodedValue containing the data that was in the stream</returns>
@ -177,7 +177,7 @@ namespace MonoTorrent.BEncoding
/// <summary> /// <summary>
/// Decode BEncoded data in the given stream /// Decode BEncoded data in the given stream
/// </summary> /// </summary>
/// <param name="stream">The stream containing the BEncoded data</param> /// <param name="stream">The stream containing the BEncoded data</param>
/// <returns>BEncodedValue containing the data that was in the stream</returns> /// <returns>BEncodedValue containing the data that was in the stream</returns>

View File

@ -61,7 +61,7 @@ namespace MonoTorrent
throw new ArgumentException(string.Format("Hash must be {0} bytes in length", HashCodeLength), "hash"); throw new ArgumentException(string.Format("Hash must be {0} bytes in length", HashCodeLength), "hash");
if (hashIndex < 0 || hashIndex > this.count) if (hashIndex < 0 || hashIndex > this.count)
throw new ArgumentOutOfRangeException("hashIndex", string.Format("hashIndex must be between 0 and {0}", this.count)); throw new ArgumentOutOfRangeException("hashIndex", string.Format("hashIndex must be between 0 and {0}", this.count));
int start = hashIndex * HashCodeLength; int start = hashIndex * HashCodeLength;
for (int i = 0; i < HashCodeLength; i++) for (int i = 0; i < HashCodeLength; i++)

View File

@ -100,7 +100,7 @@ namespace MonoTorrent
Check.InfoHash (infoHash); Check.InfoHash (infoHash);
if (infoHash.Length != 32) if (infoHash.Length != 32)
throw new ArgumentException("Infohash must be a base32 encoded 32 character string"); throw new ArgumentException("Infohash must be a base32 encoded 32 character string");
infoHash = infoHash.ToLower(); infoHash = infoHash.ToLower();
int infohashOffset =0 ; int infohashOffset =0 ;
byte[] hash = new byte[20]; byte[] hash = new byte[20];
@ -126,7 +126,7 @@ namespace MonoTorrent
Check.InfoHash (infoHash); Check.InfoHash (infoHash);
if (infoHash.Length != 40) if (infoHash.Length != 40)
throw new ArgumentException("Infohash must be 40 characters long"); throw new ArgumentException("Infohash must be 40 characters long");
byte[] hash = new byte[20]; byte[] hash = new byte[20];
for (int i = 0; i < hash.Length; i++) for (int i = 0; i < hash.Length; i++)
hash[i] = byte.Parse(infoHash.Substring(i * 2, 2), System.Globalization.NumberStyles.HexNumber); hash[i] = byte.Parse(infoHash.Substring(i * 2, 2), System.Globalization.NumberStyles.HexNumber);

View File

@ -26,7 +26,7 @@ namespace MonoTorrent
foreach (T t in enumerable) foreach (T t in enumerable)
count += action(t); count += action(t);
return count; return count;
} }

View File

@ -60,8 +60,8 @@ namespace MonoTorrent
/// <summary> /// <summary>
/// This dictionary is specific for azureus client /// This dictionary is specific for azureus client
/// It can contain /// It can contain
/// dht_backup_enable (number) /// dht_backup_enable (number)
/// Content (dictionnary) /// Content (dictionnary)
/// Publisher /// Publisher
@ -651,7 +651,7 @@ namespace MonoTorrent
public static bool TryLoad(Stream stream, out Torrent torrent) public static bool TryLoad(Stream stream, out Torrent torrent)
{ {
Check.Stream(stream); Check.Stream(stream);
try try
{ {
torrent = Torrent.Load(stream); torrent = Torrent.Load(stream);
@ -676,7 +676,7 @@ namespace MonoTorrent
{ {
Check.Url(url); Check.Url(url);
Check.Location(location); Check.Location(location);
try try
{ {
torrent = Torrent.Load(url, location); torrent = Torrent.Load(url, location);

View File

@ -114,11 +114,11 @@ namespace NzbDrone.Api.Calendar
{ {
return; return;
} }
var occurrence = calendar.Create<CalendarEvent>(); var occurrence = calendar.Create<CalendarEvent>();
occurrence.Uid = "NzbDrone_movie_" + movie.Id + (cinemasRelease ? "_cinemas" : "_physical"); occurrence.Uid = "NzbDrone_movie_" + movie.Id + (cinemasRelease ? "_cinemas" : "_physical");
occurrence.Status = movie.Status == MovieStatusType.Announced ? EventStatus.Tentative : EventStatus.Confirmed; occurrence.Status = movie.Status == MovieStatusType.Announced ? EventStatus.Tentative : EventStatus.Confirmed;
occurrence.Start = new CalDateTime(date.Value); occurrence.Start = new CalDateTime(date.Value);
occurrence.End = occurrence.Start; occurrence.End = occurrence.Start;
occurrence.IsAllDay = true; occurrence.IsAllDay = true;

View File

@ -26,7 +26,7 @@ namespace NzbDrone.Api.Config
{ {
FirstDayOfWeek = model.FirstDayOfWeek, FirstDayOfWeek = model.FirstDayOfWeek,
CalendarWeekColumnHeader = model.CalendarWeekColumnHeader, CalendarWeekColumnHeader = model.CalendarWeekColumnHeader,
ShortDateFormat = model.ShortDateFormat, ShortDateFormat = model.ShortDateFormat,
LongDateFormat = model.LongDateFormat, LongDateFormat = model.LongDateFormat,
TimeFormat = model.TimeFormat, TimeFormat = model.TimeFormat,

View File

@ -12,7 +12,7 @@ namespace NzbDrone.Api.Indexers
protected override void MapToResource(IndexerResource resource, IndexerDefinition definition) protected override void MapToResource(IndexerResource resource, IndexerDefinition definition)
{ {
base.MapToResource(resource, definition); base.MapToResource(resource, definition);
resource.EnableRss = definition.EnableRss; resource.EnableRss = definition.EnableRss;
resource.EnableSearch = definition.EnableAutomaticSearch || definition.EnableInteractiveSearch; resource.EnableSearch = definition.EnableAutomaticSearch || definition.EnableInteractiveSearch;
resource.SupportsRss = definition.SupportsRss; resource.SupportsRss = definition.SupportsRss;

View File

@ -23,7 +23,7 @@ namespace NzbDrone.Api.Indexers
private readonly IPrioritizeDownloadDecision _prioritizeDownloadDecision; private readonly IPrioritizeDownloadDecision _prioritizeDownloadDecision;
private readonly IDownloadService _downloadService; private readonly IDownloadService _downloadService;
private readonly Logger _logger; private readonly Logger _logger;
private readonly ICached<RemoteMovie> _remoteMovieCache; private readonly ICached<RemoteMovie> _remoteMovieCache;
public ReleaseModule(IFetchAndParseRss rssFetcherAndParser, public ReleaseModule(IFetchAndParseRss rssFetcherAndParser,
@ -46,7 +46,7 @@ namespace NzbDrone.Api.Indexers
//PostValidator.RuleFor(s => s.DownloadAllowed).Equal(true); //PostValidator.RuleFor(s => s.DownloadAllowed).Equal(true);
PostValidator.RuleFor(s => s.Guid).NotEmpty(); PostValidator.RuleFor(s => s.Guid).NotEmpty();
_remoteMovieCache = cacheManager.GetCache<RemoteMovie>(GetType(), "remoteMovies"); _remoteMovieCache = cacheManager.GetCache<RemoteMovie>(GetType(), "remoteMovies");
} }
@ -117,7 +117,7 @@ namespace NzbDrone.Api.Indexers
{ {
_remoteMovieCache.Set(decision.RemoteMovie.Release.Guid, decision.RemoteMovie, TimeSpan.FromMinutes(30)); _remoteMovieCache.Set(decision.RemoteMovie.Release.Guid, decision.RemoteMovie, TimeSpan.FromMinutes(30));
return base.MapDecision(decision, initialWeight); return base.MapDecision(decision, initialWeight);
} }
} }

View File

@ -39,7 +39,7 @@ namespace NzbDrone.Api.Logs
{ {
var file = files[i]; var file = files[i];
var filename = Path.GetFileName(file); var filename = Path.GetFileName(file);
result.Add(new LogFileResource result.Add(new LogFileResource
{ {
Id = i + 1, Id = i + 1,
@ -63,7 +63,7 @@ namespace NzbDrone.Api.Logs
return new NotFoundResponse(); return new NotFoundResponse();
var data = _diskProvider.ReadAllText(filePath); var data = _diskProvider.ReadAllText(filePath);
return new TextResponse(data); return new TextResponse(data);
} }

View File

@ -10,7 +10,7 @@ namespace NzbDrone.Api.Movies
{ {
public AlternativeTitleResource() public AlternativeTitleResource()
{ {
} }
//Todo: Sorters should be done completely on the client //Todo: Sorters should be done completely on the client

View File

@ -6,7 +6,7 @@ namespace NzbDrone.Api.Movies
{ {
public AlternativeYearResource() public AlternativeYearResource()
{ {
} }
//Todo: Sorters should be done completely on the client //Todo: Sorters should be done completely on the client

View File

@ -18,7 +18,7 @@ namespace NzbDrone.Api.Movies
//Todo: Sorters should be done completely on the client //Todo: Sorters should be done completely on the client
//Todo: Is there an easy way to keep IgnoreArticlesWhenSorting in sync between, Series, History, Missing? //Todo: Is there an easy way to keep IgnoreArticlesWhenSorting in sync between, Series, History, Missing?
//Todo: We should get the entire Profile instead of ID and Name separately //Todo: We should get the entire Profile instead of ID and Name separately
//View Only //View Only
public string Title { get; set; } public string Title { get; set; }
public List<AlternativeTitleResource> AlternativeTitles { get; set; } public List<AlternativeTitleResource> AlternativeTitles { get; set; }
@ -96,9 +96,9 @@ namespace NzbDrone.Api.Movies
long size = model.MovieFile?.Size ?? 0; long size = model.MovieFile?.Size ?? 0;
bool downloaded = model.MovieFile != null; bool downloaded = model.MovieFile != null;
MovieFileResource movieFile = model.MovieFile?.ToResource(); MovieFileResource movieFile = model.MovieFile?.ToResource();
/*if(model.MovieFile != null) /*if(model.MovieFile != null)
{ {
model.MovieFile.LazyLoad(); model.MovieFile.LazyLoad();
@ -110,7 +110,7 @@ namespace NzbDrone.Api.Movies
downloaded = true; downloaded = true;
movieFile = model.MovieFile.Value.ToResource(); movieFile = model.MovieFile.Value.ToResource();
}*/ }*/
//model.AlternativeTitles.LazyLoad(); //model.AlternativeTitles.LazyLoad();
return new MovieResource return new MovieResource
@ -134,18 +134,18 @@ namespace NzbDrone.Api.Movies
//NextAiring //NextAiring
//PreviousAiring //PreviousAiring
Images = model.Images, Images = model.Images,
Year = model.Year, Year = model.Year,
SecondaryYear = model.SecondaryYear, SecondaryYear = model.SecondaryYear,
SecondaryYearSourceId = model.SecondaryYearSourceId, SecondaryYearSourceId = model.SecondaryYearSourceId,
Path = model.Path, Path = model.Path,
ProfileId = model.ProfileId, ProfileId = model.ProfileId,
PathState = model.PathState, PathState = model.PathState,
Monitored = model.Monitored, Monitored = model.Monitored,
MinimumAvailability = model.MinimumAvailability, MinimumAvailability = model.MinimumAvailability,
IsAvailable = model.IsAvailable(), IsAvailable = model.IsAvailable(),
FolderName = model.FolderName(), FolderName = model.FolderName(),
@ -205,7 +205,7 @@ namespace NzbDrone.Api.Movies
Monitored = resource.Monitored, Monitored = resource.Monitored,
MinimumAvailability = resource.MinimumAvailability, MinimumAvailability = resource.MinimumAvailability,
Runtime = resource.Runtime, Runtime = resource.Runtime,
LastInfoSync = resource.LastInfoSync, LastInfoSync = resource.LastInfoSync,
CleanTitle = resource.CleanTitle, CleanTitle = resource.CleanTitle,

View File

@ -27,7 +27,7 @@ namespace NzbDrone.Api.NetImport
{ {
return _exclusionService.GetById(id).ToResource(); return _exclusionService.GetById(id).ToResource();
} }
public int AddExclusion(ImportExclusionsResource exclusionResource) public int AddExclusion(ImportExclusionsResource exclusionResource)
{ {
var model = exclusionResource.ToModel(); var model = exclusionResource.ToModel();

View File

@ -12,7 +12,7 @@ namespace NzbDrone.Api.Notifications
protected override void MapToResource(NotificationResource resource, NotificationDefinition definition) protected override void MapToResource(NotificationResource resource, NotificationDefinition definition)
{ {
base.MapToResource(resource, definition); base.MapToResource(resource, definition);
resource.OnGrab = definition.OnGrab; resource.OnGrab = definition.OnGrab;
resource.OnDownload = definition.OnDownload; resource.OnDownload = definition.OnDownload;
resource.OnUpgrade = definition.OnUpgrade; resource.OnUpgrade = definition.OnUpgrade;

View File

@ -88,7 +88,7 @@ namespace NzbDrone.Api.Queue
{ {
var resource = Request.Body.FromJson<QueueResource>(); var resource = Request.Body.FromJson<QueueResource>();
var trackedDownload = GetTrackedDownload(resource.Id); var trackedDownload = GetTrackedDownload(resource.Id);
_completedDownloadService.Process(trackedDownload, true); _completedDownloadService.Process(trackedDownload, true);
return resource; return resource;

View File

@ -10,9 +10,9 @@ namespace NzbDrone.Api.Wanted
{ {
class MovieMissingModule : MovieModuleWithSignalR class MovieMissingModule : MovieModuleWithSignalR
{ {
public MovieMissingModule(IMovieService movieService, public MovieMissingModule(IMovieService movieService,
IUpgradableSpecification qualityUpgradableSpecification, IUpgradableSpecification qualityUpgradableSpecification,
IBroadcastSignalRMessage signalRBroadcaster) IBroadcastSignalRMessage signalRBroadcaster)
: base(movieService, qualityUpgradableSpecification, signalRBroadcaster, "wanted/missing") : base(movieService, qualityUpgradableSpecification, signalRBroadcaster, "wanted/missing")
{ {
GetResourcePaged = GetMissingMovies; GetResourcePaged = GetMissingMovies;

View File

@ -76,7 +76,7 @@ namespace NzbDrone.Common.Test.DiskTests
.Returns(_folders); .Returns(_folders);
var result = Subject.LookupContents(root, false, false); var result = Subject.LookupContents(root, false, false);
result.Directories.Should().HaveCount(_folders.Count - 3); result.Directories.Should().HaveCount(_folders.Count - 3);
result.Directories.Should().NotContain(f => f.Name == RECYCLING_BIN); result.Directories.Should().NotContain(f => f.Name == RECYCLING_BIN);

View File

@ -62,7 +62,7 @@ namespace NzbDrone.Common.Test.DiskTests
{ {
if (new DriveInfo(driveletter.ToString()).IsReady) if (new DriveInfo(driveletter.ToString()).IsReady)
continue; continue;
Assert.Throws<DirectoryNotFoundException>(() => Subject.GetAvailableSpace(driveletter + @":\NOT_A_REAL_PATH\DOES_NOT_EXIST".AsOsAgnostic())); Assert.Throws<DirectoryNotFoundException>(() => Subject.GetAvailableSpace(driveletter + @":\NOT_A_REAL_PATH\DOES_NOT_EXIST".AsOsAgnostic()));
return; return;
} }

View File

@ -55,7 +55,7 @@ namespace NzbDrone.Common.Test.EnvironmentTests
args.PreservedArguments.Should().Be(preserved); args.PreservedArguments.Should().Be(preserved);
} }
[Test] [Test]
public void should_preserver_both() public void should_preserver_both()
{ {

View File

@ -301,7 +301,7 @@ namespace NzbDrone.Common.Disk
public void FileSetLastWriteTime(string path, DateTime dateTime) public void FileSetLastWriteTime(string path, DateTime dateTime)
{ {
Ensure.That(path, () => path).IsValidPath(); Ensure.That(path, () => path).IsValidPath();
if (dateTime.Before(DateTimeExtensions.Epoch)) if (dateTime.Before(DateTimeExtensions.Epoch))
{ {
dateTime = DateTimeExtensions.Epoch; dateTime = DateTimeExtensions.Epoch;

View File

@ -97,7 +97,7 @@ namespace NzbDrone.Common.Disk
{ {
return _path.StartsWith("/"); return _path.StartsWith("/");
} }
return false; return false;
} }
} }
@ -112,7 +112,7 @@ namespace NzbDrone.Common.Disk
{ {
return new OsPath(null); return new OsPath(null);
} }
return new OsPath(_path.Substring(0, index), _kind).AsDirectory(); return new OsPath(_path.Substring(0, index), _kind).AsDirectory();
} }
} }
@ -136,7 +136,7 @@ namespace NzbDrone.Common.Disk
return path; return path;
} }
return _path.Substring(index).Trim('\\', '/'); return _path.Substring(index).Trim('\\', '/');
} }
} }

View File

@ -20,15 +20,15 @@ namespace NzbDrone.Common.EnsureThat.Resources {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class ExceptionMessages { internal class ExceptionMessages {
private static global::System.Resources.ResourceManager resourceMan; private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture; private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal ExceptionMessages() { internal ExceptionMessages() {
} }
/// <summary> /// <summary>
/// Returns the cached ResourceManager instance used by this class. /// Returns the cached ResourceManager instance used by this class.
/// </summary> /// </summary>
@ -42,7 +42,7 @@ namespace NzbDrone.Common.EnsureThat.Resources {
return resourceMan; return resourceMan;
} }
} }
/// <summary> /// <summary>
/// Overrides the current thread's CurrentUICulture property for all /// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class. /// resource lookups using this strongly typed resource class.
@ -56,7 +56,7 @@ namespace NzbDrone.Common.EnsureThat.Resources {
resourceCulture = value; resourceCulture = value;
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Empty collection is not allowed.. /// Looks up a localized string similar to Empty collection is not allowed..
/// </summary> /// </summary>
@ -65,7 +65,7 @@ namespace NzbDrone.Common.EnsureThat.Resources {
return ResourceManager.GetString("EnsureExtensions_IsEmptyCollection", resourceCulture); return ResourceManager.GetString("EnsureExtensions_IsEmptyCollection", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Empty Guid is not allowed.. /// Looks up a localized string similar to Empty Guid is not allowed..
/// </summary> /// </summary>
@ -74,7 +74,7 @@ namespace NzbDrone.Common.EnsureThat.Resources {
return ResourceManager.GetString("EnsureExtensions_IsEmptyGuid", resourceCulture); return ResourceManager.GetString("EnsureExtensions_IsEmptyGuid", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Expected an expression that evaluates to false.. /// Looks up a localized string similar to Expected an expression that evaluates to false..
/// </summary> /// </summary>
@ -83,7 +83,7 @@ namespace NzbDrone.Common.EnsureThat.Resources {
return ResourceManager.GetString("EnsureExtensions_IsNotFalse", resourceCulture); return ResourceManager.GetString("EnsureExtensions_IsNotFalse", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to value &apos;{0}&apos; is not greater than limit &apos;{1}&apos;.. /// Looks up a localized string similar to value &apos;{0}&apos; is not greater than limit &apos;{1}&apos;..
/// </summary> /// </summary>
@ -92,7 +92,7 @@ namespace NzbDrone.Common.EnsureThat.Resources {
return ResourceManager.GetString("EnsureExtensions_IsNotGt", resourceCulture); return ResourceManager.GetString("EnsureExtensions_IsNotGt", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to value &apos;{0}&apos; is not greater than or equal to limit &apos;{1}&apos;.. /// Looks up a localized string similar to value &apos;{0}&apos; is not greater than or equal to limit &apos;{1}&apos;..
/// </summary> /// </summary>
@ -101,7 +101,7 @@ namespace NzbDrone.Common.EnsureThat.Resources {
return ResourceManager.GetString("EnsureExtensions_IsNotGte", resourceCulture); return ResourceManager.GetString("EnsureExtensions_IsNotGte", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to value &apos;{0}&apos; is &gt; max &apos;{1}&apos;.. /// Looks up a localized string similar to value &apos;{0}&apos; is &gt; max &apos;{1}&apos;..
/// </summary> /// </summary>
@ -110,7 +110,7 @@ namespace NzbDrone.Common.EnsureThat.Resources {
return ResourceManager.GetString("EnsureExtensions_IsNotInRange_ToHigh", resourceCulture); return ResourceManager.GetString("EnsureExtensions_IsNotInRange_ToHigh", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to The string is too long. Must be between &apos;{0}&apos; and &apos;{1}&apos;. Must be between &apos;{0}&apos; and &apos;{1}&apos; but was &apos;{2}&apos; characters long.. /// Looks up a localized string similar to The string is too long. Must be between &apos;{0}&apos; and &apos;{1}&apos;. Must be between &apos;{0}&apos; and &apos;{1}&apos; but was &apos;{2}&apos; characters long..
/// </summary> /// </summary>
@ -119,7 +119,7 @@ namespace NzbDrone.Common.EnsureThat.Resources {
return ResourceManager.GetString("EnsureExtensions_IsNotInRange_ToLong", resourceCulture); return ResourceManager.GetString("EnsureExtensions_IsNotInRange_ToLong", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to value &apos;{0}&apos; is &lt; min &apos;{1}&apos;.. /// Looks up a localized string similar to value &apos;{0}&apos; is &lt; min &apos;{1}&apos;..
/// </summary> /// </summary>
@ -128,7 +128,7 @@ namespace NzbDrone.Common.EnsureThat.Resources {
return ResourceManager.GetString("EnsureExtensions_IsNotInRange_ToLow", resourceCulture); return ResourceManager.GetString("EnsureExtensions_IsNotInRange_ToLow", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to The string is not long enough. Must be between &apos;{0}&apos; and &apos;{1}&apos; but was &apos;{2}&apos; characters long.. /// Looks up a localized string similar to The string is not long enough. Must be between &apos;{0}&apos; and &apos;{1}&apos; but was &apos;{2}&apos; characters long..
/// </summary> /// </summary>
@ -137,7 +137,7 @@ namespace NzbDrone.Common.EnsureThat.Resources {
return ResourceManager.GetString("EnsureExtensions_IsNotInRange_ToShort", resourceCulture); return ResourceManager.GetString("EnsureExtensions_IsNotInRange_ToShort", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to value &apos;{0}&apos; is not lower than limit &apos;{1}&apos;.. /// Looks up a localized string similar to value &apos;{0}&apos; is not lower than limit &apos;{1}&apos;..
/// </summary> /// </summary>
@ -146,7 +146,7 @@ namespace NzbDrone.Common.EnsureThat.Resources {
return ResourceManager.GetString("EnsureExtensions_IsNotLt", resourceCulture); return ResourceManager.GetString("EnsureExtensions_IsNotLt", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to value &apos;{0}&apos; is not lower than or equal to limit &apos;{1}&apos;.. /// Looks up a localized string similar to value &apos;{0}&apos; is not lower than or equal to limit &apos;{1}&apos;..
/// </summary> /// </summary>
@ -155,7 +155,7 @@ namespace NzbDrone.Common.EnsureThat.Resources {
return ResourceManager.GetString("EnsureExtensions_IsNotLte", resourceCulture); return ResourceManager.GetString("EnsureExtensions_IsNotLte", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Value can not be null.. /// Looks up a localized string similar to Value can not be null..
/// </summary> /// </summary>
@ -164,7 +164,7 @@ namespace NzbDrone.Common.EnsureThat.Resources {
return ResourceManager.GetString("EnsureExtensions_IsNotNull", resourceCulture); return ResourceManager.GetString("EnsureExtensions_IsNotNull", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to The string can&apos;t be null or empty.. /// Looks up a localized string similar to The string can&apos;t be null or empty..
/// </summary> /// </summary>
@ -173,7 +173,7 @@ namespace NzbDrone.Common.EnsureThat.Resources {
return ResourceManager.GetString("EnsureExtensions_IsNotNullOrEmpty", resourceCulture); return ResourceManager.GetString("EnsureExtensions_IsNotNullOrEmpty", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to The string can&apos;t be left empty, null or consist of only whitespaces.. /// Looks up a localized string similar to The string can&apos;t be left empty, null or consist of only whitespaces..
/// </summary> /// </summary>
@ -182,7 +182,7 @@ namespace NzbDrone.Common.EnsureThat.Resources {
return ResourceManager.GetString("EnsureExtensions_IsNotNullOrWhiteSpace", resourceCulture); return ResourceManager.GetString("EnsureExtensions_IsNotNullOrWhiteSpace", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to The param is not of expected type: &apos;{0}&apos;.. /// Looks up a localized string similar to The param is not of expected type: &apos;{0}&apos;..
/// </summary> /// </summary>
@ -191,7 +191,7 @@ namespace NzbDrone.Common.EnsureThat.Resources {
return ResourceManager.GetString("EnsureExtensions_IsNotOfType", resourceCulture); return ResourceManager.GetString("EnsureExtensions_IsNotOfType", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Expected an expression that evaluates to true.. /// Looks up a localized string similar to Expected an expression that evaluates to true..
/// </summary> /// </summary>
@ -200,7 +200,7 @@ namespace NzbDrone.Common.EnsureThat.Resources {
return ResourceManager.GetString("EnsureExtensions_IsNotTrue", resourceCulture); return ResourceManager.GetString("EnsureExtensions_IsNotTrue", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to value &apos;{0}&apos; does not match &apos;{1}&apos;. /// Looks up a localized string similar to value &apos;{0}&apos; does not match &apos;{1}&apos;.
/// </summary> /// </summary>
@ -209,7 +209,7 @@ namespace NzbDrone.Common.EnsureThat.Resources {
return ResourceManager.GetString("EnsureExtensions_NoMatch", resourceCulture); return ResourceManager.GetString("EnsureExtensions_NoMatch", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to No MemberExpression found in expression: &apos;{0}&apos;.. /// Looks up a localized string similar to No MemberExpression found in expression: &apos;{0}&apos;..
/// </summary> /// </summary>

View File

@ -47,7 +47,7 @@ namespace NzbDrone.Common.EnvironmentInfo
{ {
throw new RadarrStartupException("Cannot create AppFolder, Access to the path {0} is denied", _appFolderInfo.AppDataFolder); throw new RadarrStartupException("Cannot create AppFolder, Access to the path {0} is denied", _appFolderInfo.AppDataFolder);
} }
if (OsInfo.IsWindows) if (OsInfo.IsWindows)
{ {

View File

@ -38,7 +38,7 @@ namespace NzbDrone.Common.Extensions
{ {
return dateTime >= afterDateTime && dateTime <= beforeDateTime; return dateTime >= afterDateTime && dateTime <= beforeDateTime;
} }
public static DateTime Epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); public static DateTime Epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
} }
} }

View File

@ -10,7 +10,7 @@
public static readonly HttpAccept JsonCharset = new HttpAccept("application/json;charset=utf-8"); public static readonly HttpAccept JsonCharset = new HttpAccept("application/json;charset=utf-8");
#endif #endif
public static readonly HttpAccept Html = new HttpAccept("text/html"); public static readonly HttpAccept Html = new HttpAccept("text/html");
public string Value { get; private set; } public string Value { get; private set; }
public HttpAccept(string accept) public HttpAccept(string accept)

View File

@ -16,7 +16,7 @@ namespace NzbDrone.Common.Instrumentation
new Regex(@"iptorrents\.com/[/a-z0-9?&;]*?(?:[?&;](u|tp)=(?<secret>[^&=;]+?))+(?= |;|&|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase), new Regex(@"iptorrents\.com/[/a-z0-9?&;]*?(?:[?&;](u|tp)=(?<secret>[^&=;]+?))+(?= |;|&|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new Regex(@"/fetch/[a-z0-9]{32}/(?<secret>[a-z0-9]{32})", RegexOptions.Compiled), new Regex(@"/fetch/[a-z0-9]{32}/(?<secret>[a-z0-9]{32})", RegexOptions.Compiled),
new Regex(@"getnzb.*?(?<=\?|&)(r)=(?<secret>[^&=]+?)(?= |&|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase), new Regex(@"getnzb.*?(?<=\?|&)(r)=(?<secret>[^&=]+?)(?= |&|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
// Path // Path
new Regex(@"""C:\\Users\\(?<secret>[^\""]+?)(\\|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase), new Regex(@"""C:\\Users\\(?<secret>[^\""]+?)(\\|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new Regex(@"""/home/(?<secret>[^/""]+?)(/|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase), new Regex(@"""/home/(?<secret>[^/""]+?)(/|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase),

View File

@ -57,7 +57,7 @@ namespace NzbDrone.Common.Instrumentation.Sentry
private static readonly HashSet<string> IncludeExceptionMessageTypes = new HashSet<string> { private static readonly HashSet<string> IncludeExceptionMessageTypes = new HashSet<string> {
"SQLiteException" "SQLiteException"
}; };
private static readonly IDictionary<LogLevel, SentryLevel> LoggingLevelMap = new Dictionary<LogLevel, SentryLevel> private static readonly IDictionary<LogLevel, SentryLevel> LoggingLevelMap = new Dictionary<LogLevel, SentryLevel>
{ {
{LogLevel.Debug, SentryLevel.Debug}, {LogLevel.Debug, SentryLevel.Debug},
@ -244,7 +244,7 @@ namespace NzbDrone.Common.Instrumentation.Sentry
{ {
return false; return false;
} }
if (FilteredExceptionMessages.Any(x => logEvent.Exception.Message.Contains(x))) if (FilteredExceptionMessages.Any(x => logEvent.Exception.Message.Contains(x)))
{ {
return false; return false;

View File

@ -55,7 +55,7 @@ namespace NzbDrone.Common.OAuth
#endif #endif
/// <summary> /// <summary>
/// Generates a random 16-byte lowercase alphanumeric string. /// Generates a random 16-byte lowercase alphanumeric string.
/// </summary> /// </summary>
/// <seealso href="http://oauth.net/core/1.0#nonce"/> /// <seealso href="http://oauth.net/core/1.0#nonce"/>
/// <returns></returns> /// <returns></returns>
@ -259,7 +259,7 @@ namespace NzbDrone.Common.OAuth
} }
/// <summary> /// <summary>
/// Creates a request elements concatentation value to send with a request. /// Creates a request elements concatentation value to send with a request.
/// This is also known as the signature base. /// This is also known as the signature base.
/// </summary> /// </summary>
/// <seealso href="http://oauth.net/core/1.0#rfc.section.9.1.3"/> /// <seealso href="http://oauth.net/core/1.0#rfc.section.9.1.3"/>
@ -276,7 +276,7 @@ namespace NzbDrone.Common.OAuth
var requestMethod = string.Concat(method.ToUpper(), "&"); var requestMethod = string.Concat(method.ToUpper(), "&");
var requestUrl = string.Concat(UrlEncodeRelaxed(ConstructRequestUrl(new Uri(url))), "&"); var requestUrl = string.Concat(UrlEncodeRelaxed(ConstructRequestUrl(new Uri(url))), "&");
var requestParameters = UrlEncodeRelaxed(NormalizeRequestParameters(parameters)); var requestParameters = UrlEncodeRelaxed(NormalizeRequestParameters(parameters));
sb.Append(requestMethod); sb.Append(requestMethod);
sb.Append(requestUrl); sb.Append(requestUrl);
sb.Append(requestParameters); sb.Append(requestParameters);
@ -293,7 +293,7 @@ namespace NzbDrone.Common.OAuth
/// <param name="signatureBase">The signature base</param> /// <param name="signatureBase">The signature base</param>
/// <param name="consumerSecret">The consumer key</param> /// <param name="consumerSecret">The consumer key</param>
/// <returns></returns> /// <returns></returns>
public static string GetSignature(OAuthSignatureMethod signatureMethod, public static string GetSignature(OAuthSignatureMethod signatureMethod,
string signatureBase, string signatureBase,
string consumerSecret) string consumerSecret)
{ {
@ -311,7 +311,7 @@ namespace NzbDrone.Common.OAuth
/// <param name="consumerSecret">The consumer key</param> /// <param name="consumerSecret">The consumer key</param>
/// <returns></returns> /// <returns></returns>
public static string GetSignature(OAuthSignatureMethod signatureMethod, public static string GetSignature(OAuthSignatureMethod signatureMethod,
OAuthSignatureTreatment signatureTreatment, OAuthSignatureTreatment signatureTreatment,
string signatureBase, string signatureBase,
string consumerSecret) string consumerSecret)
{ {
@ -327,7 +327,7 @@ namespace NzbDrone.Common.OAuth
/// <param name="consumerSecret">The consumer secret</param> /// <param name="consumerSecret">The consumer secret</param>
/// <param name="tokenSecret">The token secret</param> /// <param name="tokenSecret">The token secret</param>
/// <returns></returns> /// <returns></returns>
public static string GetSignature(OAuthSignatureMethod signatureMethod, public static string GetSignature(OAuthSignatureMethod signatureMethod,
string signatureBase, string signatureBase,
string consumerSecret, string consumerSecret,
string tokenSecret) string tokenSecret)
@ -345,7 +345,7 @@ namespace NzbDrone.Common.OAuth
/// <param name="consumerSecret">The consumer secret</param> /// <param name="consumerSecret">The consumer secret</param>
/// <param name="tokenSecret">The token secret</param> /// <param name="tokenSecret">The token secret</param>
/// <returns></returns> /// <returns></returns>
public static string GetSignature(OAuthSignatureMethod signatureMethod, public static string GetSignature(OAuthSignatureMethod signatureMethod,
OAuthSignatureTreatment signatureTreatment, OAuthSignatureTreatment signatureTreatment,
string signatureBase, string signatureBase,
string consumerSecret, string consumerSecret,

View File

@ -15,7 +15,7 @@ namespace NzbDrone.Common.OAuth
get get
{ {
var parameters = this.Where(p => p.Name.Equals(name)); var parameters = this.Where(p => p.Name.Equals(name));
if(parameters.Count() == 0) if(parameters.Count() == 0)
{ {
return null; return null;
@ -142,7 +142,7 @@ namespace NzbDrone.Common.OAuth
public virtual void Add(WebParameter parameter) public virtual void Add(WebParameter parameter)
{ {
_parameters.Add(parameter); _parameters.Add(parameter);
} }

View File

@ -11,17 +11,17 @@ namespace NzbDrone.Common.TPL
/// <summary>Whether the current thread is processing work items.</summary> /// <summary>Whether the current thread is processing work items.</summary>
[ThreadStatic] [ThreadStatic]
private static bool _currentThreadIsProcessingItems; private static bool _currentThreadIsProcessingItems;
/// <summary>The list of tasks to be executed.</summary> /// <summary>The list of tasks to be executed.</summary>
private readonly LinkedList<Task> _tasks = new LinkedList<Task>(); // protected by lock(_tasks) private readonly LinkedList<Task> _tasks = new LinkedList<Task>(); // protected by lock(_tasks)
/// <summary>The maximum concurrency level allowed by this scheduler.</summary> /// <summary>The maximum concurrency level allowed by this scheduler.</summary>
private readonly int _maxDegreeOfParallelism; private readonly int _maxDegreeOfParallelism;
/// <summary>Whether the scheduler is currently processing work items.</summary> /// <summary>Whether the scheduler is currently processing work items.</summary>
private int _delegatesQueuedOrRunning = 0; // protected by lock(_tasks) private int _delegatesQueuedOrRunning = 0; // protected by lock(_tasks)
/// <summary> /// <summary>
/// Initializes an instance of the LimitedConcurrencyLevelTaskScheduler class with the /// Initializes an instance of the LimitedConcurrencyLevelTaskScheduler class with the
/// specified degree of parallelism. /// specified degree of parallelism.
/// </summary> /// </summary>
/// <param name="maxDegreeOfParallelism">The maximum degree of parallelism provided by this scheduler.</param> /// <param name="maxDegreeOfParallelism">The maximum degree of parallelism provided by this scheduler.</param>
public LimitedConcurrencyLevelTaskScheduler(int maxDegreeOfParallelism) public LimitedConcurrencyLevelTaskScheduler(int maxDegreeOfParallelism)
{ {
@ -29,12 +29,12 @@ namespace NzbDrone.Common.TPL
_maxDegreeOfParallelism = maxDegreeOfParallelism; _maxDegreeOfParallelism = maxDegreeOfParallelism;
} }
/// <summary>Queues a task to the scheduler.</summary> /// <summary>Queues a task to the scheduler.</summary>
/// <param name="task">The task to be queued.</param> /// <param name="task">The task to be queued.</param>
protected sealed override void QueueTask(Task task) protected sealed override void QueueTask(Task task)
{ {
// Add the task to the list of tasks to be processed. If there aren't enough // Add the task to the list of tasks to be processed. If there aren't enough
// delegates currently queued or running to process tasks, schedule another. // delegates currently queued or running to process tasks, schedule another.
lock (_tasks) lock (_tasks)
{ {
_tasks.AddLast(task); _tasks.AddLast(task);
@ -46,26 +46,26 @@ namespace NzbDrone.Common.TPL
} }
} }
/// <summary> /// <summary>
/// Informs the ThreadPool that there's work to be executed for this scheduler. /// Informs the ThreadPool that there's work to be executed for this scheduler.
/// </summary> /// </summary>
private void NotifyThreadPoolOfPendingWork() private void NotifyThreadPoolOfPendingWork()
{ {
ThreadPool.UnsafeQueueUserWorkItem(_ => ThreadPool.UnsafeQueueUserWorkItem(_ =>
{ {
// Note that the current thread is now processing work items. // Note that the current thread is now processing work items.
// This is necessary to enable inlining of tasks into this thread. // This is necessary to enable inlining of tasks into this thread.
_currentThreadIsProcessingItems = true; _currentThreadIsProcessingItems = true;
try try
{ {
// Process all available items in the queue. // Process all available items in the queue.
while (true) while (true)
{ {
Task item; Task item;
lock (_tasks) lock (_tasks)
{ {
// When there are no more items to be processed, // When there are no more items to be processed,
// note that we're done processing, and get out. // note that we're done processing, and get out.
if (_tasks.Count == 0) if (_tasks.Count == 0)
{ {
--_delegatesQueuedOrRunning; --_delegatesQueuedOrRunning;
@ -77,44 +77,44 @@ namespace NzbDrone.Common.TPL
_tasks.RemoveFirst(); _tasks.RemoveFirst();
} }
// Execute the task we pulled out of the queue // Execute the task we pulled out of the queue
base.TryExecuteTask(item); base.TryExecuteTask(item);
} }
} }
// We're done processing items on the current thread // We're done processing items on the current thread
finally { _currentThreadIsProcessingItems = false; } finally { _currentThreadIsProcessingItems = false; }
}, null); }, null);
} }
/// <summary>Attempts to execute the specified task on the current thread.</summary> /// <summary>Attempts to execute the specified task on the current thread.</summary>
/// <param name="task">The task to be executed.</param> /// <param name="task">The task to be executed.</param>
/// <param name="taskWasPreviouslyQueued"></param> /// <param name="taskWasPreviouslyQueued"></param>
/// <returns>Whether the task could be executed on the current thread.</returns> /// <returns>Whether the task could be executed on the current thread.</returns>
protected sealed override bool TryExecuteTaskInline(Task task, bool taskWasPreviouslyQueued) protected sealed override bool TryExecuteTaskInline(Task task, bool taskWasPreviouslyQueued)
{ {
// If this thread isn't already processing a task, we don't support inlining // If this thread isn't already processing a task, we don't support inlining
if (!_currentThreadIsProcessingItems) return false; if (!_currentThreadIsProcessingItems) return false;
// If the task was previously queued, remove it from the queue // If the task was previously queued, remove it from the queue
if (taskWasPreviouslyQueued) TryDequeue(task); if (taskWasPreviouslyQueued) TryDequeue(task);
// Try to run the task. // Try to run the task.
return base.TryExecuteTask(task); return base.TryExecuteTask(task);
} }
/// <summary>Attempts to remove a previously scheduled task from the scheduler.</summary> /// <summary>Attempts to remove a previously scheduled task from the scheduler.</summary>
/// <param name="task">The task to be removed.</param> /// <param name="task">The task to be removed.</param>
/// <returns>Whether the task could be found and removed.</returns> /// <returns>Whether the task could be found and removed.</returns>
protected sealed override bool TryDequeue(Task task) protected sealed override bool TryDequeue(Task task)
{ {
lock (_tasks) return _tasks.Remove(task); lock (_tasks) return _tasks.Remove(task);
} }
/// <summary>Gets the maximum concurrency level supported by this scheduler.</summary> /// <summary>Gets the maximum concurrency level supported by this scheduler.</summary>
public sealed override int MaximumConcurrencyLevel => _maxDegreeOfParallelism; public sealed override int MaximumConcurrencyLevel => _maxDegreeOfParallelism;
/// <summary>Gets an enumerable of the tasks currently scheduled on this scheduler.</summary> /// <summary>Gets an enumerable of the tasks currently scheduled on this scheduler.</summary>
/// <returns>An enumerable of the tasks currently scheduled.</returns> /// <returns>An enumerable of the tasks currently scheduled.</returns>
protected sealed override IEnumerable<Task> GetScheduledTasks() protected sealed override IEnumerable<Task> GetScheduledTasks()
{ {
bool lockTaken = false; bool lockTaken = false;

View File

@ -676,7 +676,7 @@ namespace TinyIoC
{ {
/// <summary> /// <summary>
/// Attempt to resolve type, even if the type isn't registered. /// Attempt to resolve type, even if the type isn't registered.
/// ///
/// Registered types/options will always take precedence. /// Registered types/options will always take precedence.
/// </summary> /// </summary>
AttemptResolve, AttemptResolve,
@ -689,7 +689,7 @@ namespace TinyIoC
/// <summary> /// <summary>
/// Attempt to resolve unregistered type if requested type is generic /// Attempt to resolve unregistered type if requested type is generic
/// and no registration exists for the specific generic parameters used. /// and no registration exists for the specific generic parameters used.
/// ///
/// Registered types/options will always take precedence. /// Registered types/options will always take precedence.
/// </summary> /// </summary>
GenericsOnly GenericsOnly
@ -904,7 +904,7 @@ namespace TinyIoC
#endif #endif
/// <summary> /// <summary>
/// Switches to a custom lifetime manager factory if possible. /// Switches to a custom lifetime manager factory if possible.
/// ///
/// Usually used for RegisterOptions "To*" extension methods such as the ASP.Net per-request one. /// Usually used for RegisterOptions "To*" extension methods such as the ASP.Net per-request one.
/// </summary> /// </summary>
/// <param name="instance">RegisterOptions instance</param> /// <param name="instance">RegisterOptions instance</param>
@ -994,7 +994,7 @@ namespace TinyIoC
#region Registration #region Registration
/// <summary> /// <summary>
/// Attempt to automatically register all non-generic classes and interfaces in the current app domain. /// Attempt to automatically register all non-generic classes and interfaces in the current app domain.
/// ///
/// If more than one class implements an interface then only one implementation will be registered /// If more than one class implements an interface then only one implementation will be registered
/// although no error will be thrown. /// although no error will be thrown.
/// </summary> /// </summary>
@ -1010,7 +1010,7 @@ namespace TinyIoC
/// <summary> /// <summary>
/// Attempt to automatically register all non-generic classes and interfaces in the current app domain. /// Attempt to automatically register all non-generic classes and interfaces in the current app domain.
/// Types will only be registered if they pass the supplied registration predicate. /// Types will only be registered if they pass the supplied registration predicate.
/// ///
/// If more than one class implements an interface then only one implementation will be registered /// If more than one class implements an interface then only one implementation will be registered
/// although no error will be thrown. /// although no error will be thrown.
/// </summary> /// </summary>
@ -1056,7 +1056,7 @@ namespace TinyIoC
/// <summary> /// <summary>
/// Attempt to automatically register all non-generic classes and interfaces in the specified assemblies /// Attempt to automatically register all non-generic classes and interfaces in the specified assemblies
/// ///
/// If more than one class implements an interface then only one implementation will be registered /// If more than one class implements an interface then only one implementation will be registered
/// although no error will be thrown. /// although no error will be thrown.
/// </summary> /// </summary>
@ -1069,7 +1069,7 @@ namespace TinyIoC
/// <summary> /// <summary>
/// Attempt to automatically register all non-generic classes and interfaces in the specified assemblies /// Attempt to automatically register all non-generic classes and interfaces in the specified assemblies
/// Types will only be registered if they pass the supplied registration predicate. /// Types will only be registered if they pass the supplied registration predicate.
/// ///
/// If more than one class implements an interface then only one implementation will be registered /// If more than one class implements an interface then only one implementation will be registered
/// although no error will be thrown. /// although no error will be thrown.
/// </summary> /// </summary>
@ -1361,7 +1361,7 @@ namespace TinyIoC
/// <summary> /// <summary>
/// Register multiple implementations of a type. /// Register multiple implementations of a type.
/// ///
/// Internally this registers each implementation using the full name of the class as its registration name. /// Internally this registers each implementation using the full name of the class as its registration name.
/// </summary> /// </summary>
/// <typeparam name="RegisterType">Type that each implementation implements</typeparam> /// <typeparam name="RegisterType">Type that each implementation implements</typeparam>
@ -1374,7 +1374,7 @@ namespace TinyIoC
/// <summary> /// <summary>
/// Register multiple implementations of a type. /// Register multiple implementations of a type.
/// ///
/// Internally this registers each implementation using the full name of the class as its registration name. /// Internally this registers each implementation using the full name of the class as its registration name.
/// </summary> /// </summary>
/// <param name="registrationType">Type that each implementation implements</param> /// <param name="registrationType">Type that each implementation implements</param>
@ -1720,7 +1720,7 @@ namespace TinyIoC
/// ///
/// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists). /// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists).
/// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail. /// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail.
/// ///
/// Note: Resolution may still fail if user defined factory registations fail to construct objects when called. /// Note: Resolution may still fail if user defined factory registations fail to construct objects when called.
/// </summary> /// </summary>
/// <param name="resolveType">Type to resolve</param> /// <param name="resolveType">Type to resolve</param>
@ -1736,7 +1736,7 @@ namespace TinyIoC
/// ///
/// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists). /// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists).
/// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail. /// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail.
/// ///
/// Note: Resolution may still fail if user defined factory registations fail to construct objects when called. /// Note: Resolution may still fail if user defined factory registations fail to construct objects when called.
/// </summary> /// </summary>
/// <param name="resolveType">Type to resolve</param> /// <param name="resolveType">Type to resolve</param>
@ -1753,7 +1753,7 @@ namespace TinyIoC
/// ///
/// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists). /// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists).
/// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail. /// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail.
/// ///
/// Note: Resolution may still fail if user defined factory registations fail to construct objects when called. /// Note: Resolution may still fail if user defined factory registations fail to construct objects when called.
/// </summary> /// </summary>
/// <param name="resolveType">Type to resolve</param> /// <param name="resolveType">Type to resolve</param>
@ -1770,7 +1770,7 @@ namespace TinyIoC
/// ///
/// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists). /// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists).
/// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail. /// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail.
/// ///
/// Note: Resolution may still fail if user defined factory registations fail to construct objects when called. /// Note: Resolution may still fail if user defined factory registations fail to construct objects when called.
/// </summary> /// </summary>
/// <param name="resolveType">Type to resolve</param> /// <param name="resolveType">Type to resolve</param>
@ -1845,7 +1845,7 @@ namespace TinyIoC
/// ///
/// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists). /// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists).
/// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail. /// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail.
/// ///
/// Note: Resolution may still fail if user defined factory registations fail to construct objects when called. /// Note: Resolution may still fail if user defined factory registations fail to construct objects when called.
/// </summary> /// </summary>
/// <typeparam name="ResolveType">Type to resolve</typeparam> /// <typeparam name="ResolveType">Type to resolve</typeparam>
@ -1862,7 +1862,7 @@ namespace TinyIoC
/// ///
/// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists). /// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists).
/// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail. /// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail.
/// ///
/// Note: Resolution may still fail if user defined factory registations fail to construct objects when called. /// Note: Resolution may still fail if user defined factory registations fail to construct objects when called.
/// </summary> /// </summary>
/// <typeparam name="ResolveType">Type to resolve</typeparam> /// <typeparam name="ResolveType">Type to resolve</typeparam>
@ -1880,7 +1880,7 @@ namespace TinyIoC
/// ///
/// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists). /// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists).
/// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail. /// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail.
/// ///
/// Note: Resolution may still fail if user defined factory registations fail to construct objects when called. /// Note: Resolution may still fail if user defined factory registations fail to construct objects when called.
/// </summary> /// </summary>
/// <typeparam name="ResolveType">Type to resolve</typeparam> /// <typeparam name="ResolveType">Type to resolve</typeparam>
@ -1898,7 +1898,7 @@ namespace TinyIoC
/// ///
/// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists). /// Parameters are used in conjunction with normal container resolution to find the most suitable constructor (if one exists).
/// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail. /// All user supplied parameters must exist in at least one resolvable constructor of RegisterType or resolution will fail.
/// ///
/// Note: Resolution may still fail if user defined factory registations fail to construct objects when called. /// Note: Resolution may still fail if user defined factory registations fail to construct objects when called.
/// </summary> /// </summary>
/// <typeparam name="ResolveType">Type to resolve</typeparam> /// <typeparam name="ResolveType">Type to resolve</typeparam>
@ -2360,7 +2360,7 @@ namespace TinyIoC
{ {
/// <summary> /// <summary>
/// Whether to assume this factory sucessfully constructs its objects /// Whether to assume this factory sucessfully constructs its objects
/// ///
/// Generally set to true for delegate style factories as CanResolve cannot delve /// Generally set to true for delegate style factories as CanResolve cannot delve
/// into the delegates they contain. /// into the delegates they contain.
/// </summary> /// </summary>
@ -2638,7 +2638,7 @@ namespace TinyIoC
/// <summary> /// <summary>
/// Stores an particular instance to return for a type /// Stores an particular instance to return for a type
/// ///
/// Stores the instance with a weak reference /// Stores the instance with a weak reference
/// </summary> /// </summary>
private class WeakInstanceFactory : ObjectFactoryBase, IDisposable private class WeakInstanceFactory : ObjectFactoryBase, IDisposable
@ -3427,7 +3427,7 @@ namespace TinyIoC
var isParameterOverload = parameters.ContainsKey(parameter.Name); var isParameterOverload = parameters.ContainsKey(parameter.Name);
//#if NETFX_CORE //#if NETFX_CORE
// if (parameter.ParameterType.GetTypeInfo().IsPrimitive && !isParameterOverload) // if (parameter.ParameterType.GetTypeInfo().IsPrimitive && !isParameterOverload)
//#else //#else
if (parameter.ParameterType.IsPrimitive() && !isParameterOverload) if (parameter.ParameterType.IsPrimitive() && !isParameterOverload)
@ -3578,7 +3578,7 @@ namespace TinyIoC
// We could lock the cache here, but there's no real side // We could lock the cache here, but there's no real side
// effect to two threads creating the same ObjectConstructor // effect to two threads creating the same ObjectConstructor
// at the same time, compared to the cost of a lock for // at the same time, compared to the cost of a lock for
// every creation. // every creation.
var constructorParams = constructor.GetParameters(); var constructorParams = constructor.GetParameters();
var lambdaParams = Expression.Parameter(typeof(object[]), "parameters"); var lambdaParams = Expression.Parameter(typeof(object[]), "parameters");

View File

@ -42,7 +42,7 @@ namespace NzbDrone.Core.Test.Datastore
MapRepository.Instance.RegisterTypeConverter(typeof(List<EmbeddedType>), new EmbeddedDocumentConverter()); MapRepository.Instance.RegisterTypeConverter(typeof(List<EmbeddedType>), new EmbeddedDocumentConverter());
MapRepository.Instance.RegisterTypeConverter(typeof(EmbeddedType), new EmbeddedDocumentConverter()); MapRepository.Instance.RegisterTypeConverter(typeof(EmbeddedType), new EmbeddedDocumentConverter());
MapRepository.Instance.RegisterTypeConverter(typeof(int), new Int32Converter()); MapRepository.Instance.RegisterTypeConverter(typeof(int), new Int32Converter());
} }

View File

@ -33,7 +33,7 @@ namespace NzbDrone.Core.Test.Datastore.Migration
c.Insert.IntoTable("Tags").Row(new c.Insert.IntoTable("Tags").Row(new
{ {
Label = "test" Label = "test"
}); });
}); });

View File

@ -15,7 +15,7 @@ namespace NzbDrone.Core.Test.Datastore.Migration
{ {
var db = WithMigrationTestDb(c => var db = WithMigrationTestDb(c =>
{ {
c.Insert.IntoTable("DownloadClients").Row(new c.Insert.IntoTable("DownloadClients").Row(new
{ {
Enable = 1, Enable = 1,
Name = "Deluge", Name = "Deluge",

View File

@ -15,7 +15,7 @@ namespace NzbDrone.Core.Test.Datastore.Migration
{ {
var db = WithMigrationTestDb(c => var db = WithMigrationTestDb(c =>
{ {
c.Insert.IntoTable("Notifications").Row(new c.Insert.IntoTable("Notifications").Row(new
{ {
OnGrab = false, OnGrab = false,
OnDownload = false, OnDownload = false,
@ -71,7 +71,7 @@ namespace NzbDrone.Core.Test.Datastore.Migration
OnUpgrade = false, OnUpgrade = false,
Name = "PushBullet", Name = "PushBullet",
Implementation = "PushBullet", Implementation = "PushBullet",
Settings = new Settings = new
{ {
ApiKey = "my_api_key", ApiKey = "my_api_key",
DeviceId = deviceId DeviceId = deviceId

View File

@ -20,7 +20,7 @@ namespace NzbDrone.Core.Test.Datastore.Migration
{ {
var db = WithMigrationTestDb(c => var db = WithMigrationTestDb(c =>
{ {
c.Insert.IntoTable("Indexers").Row(new c.Insert.IntoTable("Indexers").Row(new
{ {
Name = "Kickass_wrong_url", Name = "Kickass_wrong_url",
Implementation = "KickassTorrents", Implementation = "KickassTorrents",

View File

@ -64,7 +64,7 @@ namespace NzbDrone.Core.Test.Datastore.SqliteSchemaDumperTests
result.Columns.First().Name.Should().Be("MyId"); result.Columns.First().Name.Should().Be("MyId");
result.Columns.First().Type.Should().BeNull(); result.Columns.First().Type.Should().BeNull();
} }
[Test] [Test]
public void should_ignore_unknown_symbols() public void should_ignore_unknown_symbols()
{ {

View File

@ -23,7 +23,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
_remoteEpisode = new RemoteMovie(); _remoteEpisode = new RemoteMovie();
_remoteEpisode.Release = new ReleaseInfo(); _remoteEpisode.Release = new ReleaseInfo();
_remoteEpisode.Movie = new Movie(); _remoteEpisode.Movie = new Movie();
_delayProfile = new DelayProfile(); _delayProfile = new DelayProfile();
Mocker.GetMock<IDelayProfileService>() Mocker.GetMock<IDelayProfileService>()

View File

@ -31,7 +31,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
{ {
_remoteMovie.Release.Container = container; _remoteMovie.Release.Container = container;
} }
[Test] [Test]
public void should_return_true_if_no_container_specified() public void should_return_true_if_no_container_specified()
{ {

View File

@ -57,7 +57,7 @@ namespace NzbDrone.Core.Test.Download.DownloadApprovedReportsTests
MovieTitle = "A Movie", MovieTitle = "A Movie",
}, },
Movie = movie, Movie = movie,
Release = new ReleaseInfo() Release = new ReleaseInfo()
{ {
PublishDate = DateTime.UtcNow, PublishDate = DateTime.UtcNow,

View File

@ -119,7 +119,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DelugeTests
.Returns("CBC2F069FE8BB2F544EAE707D75BCD3DE9DCF951".ToLower()) .Returns("CBC2F069FE8BB2F544EAE707D75BCD3DE9DCF951".ToLower())
.Callback(PrepareClientToReturnQueuedItem); .Callback(PrepareClientToReturnQueuedItem);
} }
protected virtual void GivenTorrents(List<DelugeTorrent> torrents) protected virtual void GivenTorrents(List<DelugeTorrent> torrents)
{ {
if (torrents == null) if (torrents == null)
@ -134,7 +134,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DelugeTests
protected void PrepareClientToReturnQueuedItem() protected void PrepareClientToReturnQueuedItem()
{ {
GivenTorrents(new List<DelugeTorrent> GivenTorrents(new List<DelugeTorrent>
{ {
_queued _queued
}); });
@ -142,7 +142,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DelugeTests
protected void PrepareClientToReturnDownloadingItem() protected void PrepareClientToReturnDownloadingItem()
{ {
GivenTorrents(new List<DelugeTorrent> GivenTorrents(new List<DelugeTorrent>
{ {
_downloading _downloading
}); });
@ -150,7 +150,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DelugeTests
protected void PrepareClientToReturnFailedItem() protected void PrepareClientToReturnFailedItem()
{ {
GivenTorrents(new List<DelugeTorrent> GivenTorrents(new List<DelugeTorrent>
{ {
_failed _failed
}); });

View File

@ -565,7 +565,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests
var item = Subject.GetItems().Single(); var item = Subject.GetItems().Single();
item.CanBeRemoved.Should().BeFalse(); item.CanBeRemoved.Should().BeFalse();
item.CanMoveFiles.Should().BeFalse(); item.CanMoveFiles.Should().BeFalse();
var item2 = Subject.GetItems().Single(); var item2 = Subject.GetItems().Single();
Mocker.GetMock<IQBittorrentProxy>() Mocker.GetMock<IQBittorrentProxy>()

View File

@ -144,7 +144,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.TransmissionTests
.Setup(s => s.AddTorrentFromData(It.IsAny<byte[]>(), It.IsAny<string>(), It.IsAny<TransmissionSettings>())) .Setup(s => s.AddTorrentFromData(It.IsAny<byte[]>(), It.IsAny<string>(), It.IsAny<TransmissionSettings>()))
.Callback(PrepareClientToReturnQueuedItem); .Callback(PrepareClientToReturnQueuedItem);
} }
protected virtual void GivenTorrents(List<TransmissionTorrent> torrents) protected virtual void GivenTorrents(List<TransmissionTorrent> torrents)
{ {
if (torrents == null) if (torrents == null)
@ -159,7 +159,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.TransmissionTests
protected void PrepareClientToReturnQueuedItem() protected void PrepareClientToReturnQueuedItem()
{ {
GivenTorrents(new List<TransmissionTorrent> GivenTorrents(new List<TransmissionTorrent>
{ {
_queued _queued
}); });
@ -167,7 +167,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.TransmissionTests
protected void PrepareClientToReturnDownloadingItem() protected void PrepareClientToReturnDownloadingItem()
{ {
GivenTorrents(new List<TransmissionTorrent> GivenTorrents(new List<TransmissionTorrent>
{ {
_downloading _downloading
}); });
@ -175,7 +175,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.TransmissionTests
protected void PrepareClientToReturnFailedItem() protected void PrepareClientToReturnFailedItem()
{ {
GivenTorrents(new List<TransmissionTorrent> GivenTorrents(new List<TransmissionTorrent>
{ {
_failed _failed
}); });

View File

@ -74,7 +74,7 @@ namespace NzbDrone.Core.Test.Download
{ {
var mock = WithUsenetClient(); var mock = WithUsenetClient();
mock.Setup(s => s.Download(It.IsAny<RemoteMovie>())); mock.Setup(s => s.Download(It.IsAny<RemoteMovie>()));
Subject.DownloadReport(_parseResult); Subject.DownloadReport(_parseResult);
VerifyEventPublished<MovieGrabbedEvent>(); VerifyEventPublished<MovieGrabbedEvent>();
@ -85,7 +85,7 @@ namespace NzbDrone.Core.Test.Download
{ {
var mock = WithUsenetClient(); var mock = WithUsenetClient();
mock.Setup(s => s.Download(It.IsAny<RemoteMovie>())); mock.Setup(s => s.Download(It.IsAny<RemoteMovie>()));
Subject.DownloadReport(_parseResult); Subject.DownloadReport(_parseResult);
mock.Verify(s => s.Download(It.IsAny<RemoteMovie>()), Times.Once()); mock.Verify(s => s.Download(It.IsAny<RemoteMovie>()), Times.Once());
@ -109,7 +109,7 @@ namespace NzbDrone.Core.Test.Download
var mock = WithUsenetClient(); var mock = WithUsenetClient();
mock.Setup(s => s.Download(It.IsAny<RemoteMovie>())) mock.Setup(s => s.Download(It.IsAny<RemoteMovie>()))
.Callback<RemoteMovie>(v => { .Callback<RemoteMovie>(v => {
throw new ReleaseDownloadException(v.Release, "Error", new WebException()); throw new ReleaseDownloadException(v.Release, "Error", new WebException());
}); });
Assert.Throws<ReleaseDownloadException>(() => Subject.DownloadReport(_parseResult)); Assert.Throws<ReleaseDownloadException>(() => Subject.DownloadReport(_parseResult));
@ -128,7 +128,7 @@ namespace NzbDrone.Core.Test.Download
var mock = WithUsenetClient(); var mock = WithUsenetClient();
mock.Setup(s => s.Download(It.IsAny<RemoteMovie>())) mock.Setup(s => s.Download(It.IsAny<RemoteMovie>()))
.Callback<RemoteMovie>(v => { .Callback<RemoteMovie>(v => {
throw new ReleaseDownloadException(v.Release, "Error", new TooManyRequestsException(request, response)); throw new ReleaseDownloadException(v.Release, "Error", new TooManyRequestsException(request, response));
}); });
Assert.Throws<ReleaseDownloadException>(() => Subject.DownloadReport(_parseResult)); Assert.Throws<ReleaseDownloadException>(() => Subject.DownloadReport(_parseResult));

View File

@ -69,7 +69,7 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests
Mocker.GetMock<IMovieService>() Mocker.GetMock<IMovieService>()
.Setup(s => s.GetMovie(It.IsAny<int>())) .Setup(s => s.GetMovie(It.IsAny<int>()))
.Returns(_movie); .Returns(_movie);
Mocker.GetMock<IMovieService>() Mocker.GetMock<IMovieService>()
.Setup(s => s.GetMovies(It.IsAny<IEnumerable<int>>())) .Setup(s => s.GetMovies(It.IsAny<IEnumerable<int>>()))
.Returns(new List<Movie> { _movie }); .Returns(new List<Movie> { _movie });

View File

@ -9,7 +9,7 @@ using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test namespace NzbDrone.Core.Test
{ {
[TestFixture] [TestFixture]
public class FluentTest : CoreTest public class FluentTest : CoreTest
{ {
[TestCase(null, "def", "def")] [TestCase(null, "def", "def")]
@ -87,10 +87,10 @@ namespace NzbDrone.Core.Test
[Test] [Test]
public void MaxOrDefault_should_return_zero_when_collection_is_empty() public void MaxOrDefault_should_return_zero_when_collection_is_empty()
{ {
var result = (new List<int>()).MaxOrDefault(); var result = (new List<int>()).MaxOrDefault();
//Resolve //Resolve
@ -100,10 +100,10 @@ namespace NzbDrone.Core.Test
[Test] [Test]
public void MaxOrDefault_should_return_max_when_collection_is_not_empty() public void MaxOrDefault_should_return_max_when_collection_is_not_empty()
{ {
var list = new List<int> { 6, 4, 5, 3, 8, 10 }; var list = new List<int> { 6, 4, 5, 3, 8, 10 };
var result = list.MaxOrDefault(); var result = list.MaxOrDefault();
//Resolve //Resolve
@ -113,10 +113,10 @@ namespace NzbDrone.Core.Test
[Test] [Test]
public void MaxOrDefault_should_return_zero_when_collection_is_null() public void MaxOrDefault_should_return_zero_when_collection_is_null()
{ {
List<int> list = null; List<int> list = null;
var result = list.MaxOrDefault(); var result = list.MaxOrDefault();
//Resolve //Resolve
@ -126,10 +126,10 @@ namespace NzbDrone.Core.Test
[Test] [Test]
public void Truncate_should_truncate_strings_to_max_specified_number_of_bytes() public void Truncate_should_truncate_strings_to_max_specified_number_of_bytes()
{ {
var str = ReadAllText("Files/LongOverview.txt"); var str = ReadAllText("Files/LongOverview.txt");
var resultString = str.Truncate(1000); var resultString = str.Truncate(1000);
//Resolve //Resolve
@ -140,10 +140,10 @@ namespace NzbDrone.Core.Test
[Test] [Test]
public void Truncate_should_not_truncate_string_shorter_than_max_bytes() public void Truncate_should_not_truncate_string_shorter_than_max_bytes()
{ {
var str = "Hello World"; var str = "Hello World";
var resultString = str.Truncate(1000); var resultString = str.Truncate(1000);
//Resolve //Resolve
@ -154,10 +154,10 @@ namespace NzbDrone.Core.Test
[Test] [Test]
public void MinOrDefault_should_return_zero_when_collection_is_empty() public void MinOrDefault_should_return_zero_when_collection_is_empty()
{ {
var result = (new List<int>()).MinOrDefault(); var result = (new List<int>()).MinOrDefault();
//Resolve //Resolve
@ -167,10 +167,10 @@ namespace NzbDrone.Core.Test
[Test] [Test]
public void MinOrDefault_should_return_min_when_collection_is_not_empty() public void MinOrDefault_should_return_min_when_collection_is_not_empty()
{ {
var list = new List<int> { 6, 4, 5, 3, 8, 10 }; var list = new List<int> { 6, 4, 5, 3, 8, 10 };
var result = list.MinOrDefault(); var result = list.MinOrDefault();
//Resolve //Resolve
@ -180,10 +180,10 @@ namespace NzbDrone.Core.Test
[Test] [Test]
public void MinOrDefault_should_return_zero_when_collection_is_null() public void MinOrDefault_should_return_zero_when_collection_is_null()
{ {
List<int> list = null; List<int> list = null;
var result = list.MinOrDefault(); var result = list.MinOrDefault();
//Resolve //Resolve

View File

@ -25,7 +25,7 @@ namespace NzbDrone.Core.Test.Framework
_providerFactory = dataMapper.ProviderFactory; _providerFactory = dataMapper.ProviderFactory;
_connectionString = dataMapper.ConnectionString; _connectionString = dataMapper.ConnectionString;
} }
private DbConnection OpenConnection() private DbConnection OpenConnection()
{ {
var connection = _providerFactory.CreateConnection(); var connection = _providerFactory.CreateConnection();

View File

@ -32,10 +32,10 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
public void should_return_warning_when_both_completeddownloadhandling_and_dronefactory_are_not_configured() public void should_return_warning_when_both_completeddownloadhandling_and_dronefactory_are_not_configured()
{ {
GivenCompletedDownloadHandling(false); GivenCompletedDownloadHandling(false);
Subject.Check().ShouldBeWarning(); Subject.Check().ShouldBeWarning();
} }
[Test] [Test]
public void should_return_ok_when_no_issues_found() public void should_return_ok_when_no_issues_found()
{ {

View File

@ -43,7 +43,7 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
Mocker.GetMock<IHttpClient>() Mocker.GetMock<IHttpClient>()
.Setup(o => o.Execute(It.Is<HttpRequest>(v => v.Method == HttpMethod.GET))) .Setup(o => o.Execute(It.Is<HttpRequest>(v => v.Method == HttpMethod.GET)))
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), recentFeed)); .Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), recentFeed));
var releases = Subject.FetchRecent(); var releases = Subject.FetchRecent();
releases.Should().HaveCount(100); releases.Should().HaveCount(100);

View File

@ -35,7 +35,7 @@ namespace NzbDrone.Core.Test.IndexerTests.OmgwtfnzbsTests
Mocker.GetMock<IHttpClient>() Mocker.GetMock<IHttpClient>()
.Setup(o => o.Execute(It.Is<HttpRequest>(v => v.Method == HttpMethod.GET))) .Setup(o => o.Execute(It.Is<HttpRequest>(v => v.Method == HttpMethod.GET)))
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), recentFeed)); .Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), recentFeed));
var releases = Subject.FetchRecent(); var releases = Subject.FetchRecent();
releases.Should().HaveCount(100); releases.Should().HaveCount(100);

View File

@ -31,13 +31,13 @@ namespace NzbDrone.Core.Test.IndexerTests.TorrentRssIndexerTests
/// </summary> /// </summary>
private void SetupNLog() private void SetupNLog()
{ {
// Step 1. Create configuration object // Step 1. Create configuration object
var config = new LoggingConfiguration(); var config = new LoggingConfiguration();
var fileTarget = new FileTarget(); var fileTarget = new FileTarget();
config.AddTarget("file", fileTarget); config.AddTarget("file", fileTarget);
// Step 3. Set target properties // Step 3. Set target properties
fileTarget.FileName = "${basedir}/log.txt"; fileTarget.FileName = "${basedir}/log.txt";
fileTarget.Layout = GetStandardLayout(); fileTarget.Layout = GetStandardLayout();

View File

@ -36,10 +36,10 @@ namespace NzbDrone.Core.Test.MediaCoverTests
private void ExecuteAndVerifyCommand(Movie movie) private void ExecuteAndVerifyCommand(Movie movie)
{ {
Subject.HandleAsync(new MovieUpdatedEvent(movie)); Subject.HandleAsync(new MovieUpdatedEvent(movie));
Mocker.GetMock<IManageCommandQueue>() Mocker.GetMock<IManageCommandQueue>()
.Verify(v => v.Push(It.Is<EnsureMediaCoversCommand>(c => c.MovieId == movie.Id), It.IsAny<CommandPriority>(), It.IsAny<CommandTrigger>()), Times.Once()); .Verify(v => v.Push(It.Is<EnsureMediaCoversCommand>(c => c.MovieId == movie.Id), It.IsAny<CommandPriority>(), It.IsAny<CommandTrigger>()), Times.Once());
Subject.Execute(new EnsureMediaCoversCommand(movie.Id)); Subject.Execute(new EnsureMediaCoversCommand(movie.Id));
} }

View File

@ -199,7 +199,7 @@ namespace NzbDrone.Core.Test.MediaFiles.MediaInfo
Mocker.GetMock<IConfigService>() Mocker.GetMock<IConfigService>()
.SetupGet(s => s.EnableMediaInfo) .SetupGet(s => s.EnableMediaInfo)
.Returns(false); .Returns(false);
GivenFileExists(); GivenFileExists();
GivenSuccessfulScan(); GivenSuccessfulScan();
@ -222,7 +222,7 @@ namespace NzbDrone.Core.Test.MediaFiles.MediaInfo
Mocker.GetMock<IConfigService>() Mocker.GetMock<IConfigService>()
.SetupGet(s => s.EnableMediaInfo) .SetupGet(s => s.EnableMediaInfo)
.Returns(false); .Returns(false);
GivenFileExists(); GivenFileExists();
GivenSuccessfulScan(); GivenSuccessfulScan();
@ -254,7 +254,7 @@ namespace NzbDrone.Core.Test.MediaFiles.MediaInfo
Mocker.GetMock<IMediaFileService>() Mocker.GetMock<IMediaFileService>()
.Verify(v => v.Update(movieFile), Times.Once()); .Verify(v => v.Update(movieFile), Times.Once());
} }
[Test] [Test]
public void should_not_update_media_info_if_new_info_is_null() public void should_not_update_media_info_if_new_info_is_null()
{ {
@ -270,7 +270,7 @@ namespace NzbDrone.Core.Test.MediaFiles.MediaInfo
movieFile.MediaInfo.Should().NotBeNull(); movieFile.MediaInfo.Should().NotBeNull();
} }
[Test] [Test]
public void should_not_save_movie_file_if_new_info_is_null() public void should_not_save_movie_file_if_new_info_is_null()
{ {

View File

@ -9,7 +9,7 @@ using System.Collections.Generic;
namespace NzbDrone.Core.Test.MediaFiles.MovieImport.Aggregation.Aggregators namespace NzbDrone.Core.Test.MediaFiles.MovieImport.Aggregation.Aggregators
{ {
[TestFixture] [TestFixture]
public class AggregateLanguageFixture : CoreTest<AggregateLanguage> public class AggregateLanguageFixture : CoreTest<AggregateLanguage>
{ {
private LocalMovie _localMovie; private LocalMovie _localMovie;

View File

@ -13,7 +13,7 @@ using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.MediaFiles.MovieImport.Aggregation.Aggregators namespace NzbDrone.Core.Test.MediaFiles.MovieImport.Aggregation.Aggregators
{ {
[TestFixture] [TestFixture]
public class AugmentQualityFixture : CoreTest<AggregateQuality> public class AugmentQualityFixture : CoreTest<AggregateQuality>
{ {
private Mock<IAugmentQuality> _mediaInfoAugmenter; private Mock<IAugmentQuality> _mediaInfoAugmenter;

View File

@ -60,7 +60,7 @@ namespace NzbDrone.Core.Test.MediaFiles
ExecuteCommand(); ExecuteCommand();
ExceptionVerification.ExpectedWarns(1); ExceptionVerification.ExpectedWarns(1);
Mocker.GetMock<IMediaFileService>().Verify(s => s.Update(It.IsAny<MovieFile>()), Times.Never()); Mocker.GetMock<IMediaFileService>().Verify(s => s.Update(It.IsAny<MovieFile>()), Times.Never());
} }

View File

@ -95,12 +95,12 @@ namespace NzbDrone.Core.Test.Messaging.Events
var handlers = new List<IHandleAsync<EventA>> var handlers = new List<IHandleAsync<EventA>>
{ {
AsyncHandlerA1.Object,
AsyncHandlerA1.Object, AsyncHandlerA1.Object,
AsyncHandlerA1.Object, AsyncHandlerA1.Object,
AsyncHandlerA1.Object, AsyncHandlerA1.Object,
AsyncHandlerA1.Object, AsyncHandlerA1.Object,
AsyncHandlerA1.Object, AsyncHandlerA1.Object,
AsyncHandlerA1.Object,
AsyncHandlerA1.Object, AsyncHandlerA1.Object,
}; };

View File

@ -83,7 +83,7 @@ namespace NzbDrone.Core.Test.NotificationTests
throw new NotImplementedException(); throw new NotImplementedException();
} }
} }
[Test] [Test]

View File

@ -61,7 +61,7 @@ namespace NzbDrone.Core.Test.NotificationTests.Xbmc
{ {
ImdbId = "tt01000", ImdbId = "tt01000",
Title = "Does not exist" Title = "Does not exist"
}; };
} }
[Test] [Test]

Some files were not shown because too many files have changed in this diff Show More