diff --git a/Libraries/Migrator.NET/Migrator.Framework.dll b/Libraries/Migrator.NET/Migrator.Framework.dll
new file mode 100644
index 000000000..97ceaeea3
Binary files /dev/null and b/Libraries/Migrator.NET/Migrator.Framework.dll differ
diff --git a/Libraries/Migrator.NET/Migrator.Framework.pdb b/Libraries/Migrator.NET/Migrator.Framework.pdb
new file mode 100644
index 000000000..01826492f
Binary files /dev/null and b/Libraries/Migrator.NET/Migrator.Framework.pdb differ
diff --git a/Libraries/Migrator.NET/Migrator.Framework.xml b/Libraries/Migrator.NET/Migrator.Framework.xml
new file mode 100644
index 000000000..41fba991d
--- /dev/null
+++ b/Libraries/Migrator.NET/Migrator.Framework.xml
@@ -0,0 +1,914 @@
+
+
+
+ Migrator.Framework
+
+
+
+
+ A migration is a group of transformation applied to the database schema
+ (or sometimes data) to port the database from one version to another.
+ The Up() method must apply the modifications (eg.: create a table)
+ and the Down() method must revert, or rollback the modifications
+ (eg.: delete a table).
+
+ Each migration must be decorated with the [Migration(0)] attribute.
+ Each migration number (0) must be unique, or else a
+ DuplicatedVersionException will be trown.
+
+
+ All migrations are executed inside a transaction. If an exception is
+ thrown, the transaction will be rolledback and transformations wont be
+ applied.
+
+
+ It is best to keep a limited number of transformation inside a migration
+ so you can easely move from one version of to another with fine grain
+ modifications.
+ You should give meaningful name to the migration class and prepend the
+ migration number to the filename so they keep ordered, eg.:
+ 002_CreateTableTest.cs.
+
+
+ Use the Database property to apply transformation and the
+ Logger property to output informations in the console (or other).
+ For more details on transformations see
+ ITransformationProvider.
+
+
+
+ The following migration creates a new Customer table.
+ (File 003_AddCustomerTable.cs)
+
+ [Migration(3)]
+ public class AddCustomerTable : Migration
+ {
+ public override void Up()
+ {
+ Database.AddTable("Customer",
+ new Column("Name", typeof(string), 50),
+ new Column("Address", typeof(string), 100)
+ );
+ }
+ public override void Down()
+ {
+ Database.RemoveTable("Customer");
+ }
+ }
+
+
+
+
+
+ Defines tranformations to port the database to the current version.
+
+
+
+
+ This is run after the Up transaction has been committed
+
+
+
+
+ Defines transformations to revert things done in Up.
+
+
+
+
+ This is run after the Down transaction has been committed
+
+
+
+
+ This gets called once on the first migration object.
+
+
+
+
+ Represents the database.
+ .
+
+ Migration.Framework.ITransformationProvider
+
+
+
+ Defines tranformations to port the database to the current version.
+
+
+
+
+ This is run after the Up transaction has been committed
+
+
+
+
+ Defines transformations to revert things done in Up.
+
+
+
+
+ This is run after the Down transaction has been committed
+
+
+
+
+ This gets called once on the first migration object.
+
+
+
+
+ Represents the database.
+ .
+
+ Migration.Framework.ITransformationProvider
+
+
+
+ Log that we have started a migration
+
+ Start list of versions
+ Final Version
+
+
+
+ Log that we are migrating up
+
+ Version we are migrating to
+ Migration name
+
+
+
+ Log that we are migrating down
+
+ Version we are migrating to
+ Migration name
+
+
+
+ Inform that a migration corresponding to the number of
+ version is untraceable (not found?) and will be ignored.
+
+ Version we couldnt find
+
+
+
+ Log that we are rolling back to version
+
+
+ version
+
+
+
+
+ Log a Sql statement that changes the schema or content of the database as part of a migration
+
+
+ SELECT statements should not be logged using this method as they do not alter the data or schema of the
+ database.
+
+ The Sql statement to log
+
+
+
+ Log that we had an exception on a migration
+
+ The version of the migration that caused the exception.
+ The name of the migration that caused the exception.
+ The exception itself
+
+
+
+ Log that we had an exception on a migration
+
+ An informative message to show to the user.
+ The exception itself
+
+
+
+ Log that we have finished a migration
+
+ List of versions with which we started
+ Final Version
+
+
+
+ Log a message
+
+ The format string ("{0}, blabla {1}").
+ Parameters to apply to the format string.
+
+
+
+ Log a Warning
+
+ The format string ("{0}, blabla {1}").
+ Parameters to apply to the format string.
+
+
+
+ Log a Trace Message
+
+ The format string ("{0}, blabla {1}").
+ Parameters to apply to the format string.
+
+
+
+ Base class for migration errors.
+
+
+
+
+ Return the plural of a word.
+
+ The singular form
+ The plural form of
+
+
+
+ Return the singular of a word.
+
+ The plural form
+ The singular form of
+
+
+
+ Capitalizes a word.
+
+ The word to be capitalized.
+ capitalized.
+
+
+
+ Convert a classname to something more readable.
+ ex.: CreateATable => Create a table
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Handles writing a message to the log medium (i.e. file, console)
+
+
+
+
+ Write this message
+
+
+
+
+
+
+ Write this message, as a line
+
+
+
+
+
+
+ Represents a table column properties.
+
+
+
+
+ Null is allowable
+
+
+
+
+ Null is not allowable
+
+
+
+
+ Identity column, autoinc
+
+
+
+
+ Unique Column
+
+
+
+
+ Indexed Column
+
+
+
+
+ Unsigned Column
+
+
+
+
+ Foreign Key
+
+
+
+
+ Primary Key
+
+
+
+
+ Primary key. Make the column a PrimaryKey and unsigned
+
+
+
+
+ A set of extension methods for the transformation provider to make it easier to
+ build many-to-many joining tables (takes care of adding the joining table and foreign
+ key constraints as necessary.
+ This functionality was useful when bootstrapping a number of projects a few years ago, but
+ now that most changes are brown-field I'm thinking of removing these methods as it's easier to maintain
+ code that creates the tables etc. directly within migration.
+
+
+
+
+ Describe a migration
+
+
+
+
+ Describe the migration
+
+ The unique version of the migration.
+
+
+
+ The version reflected by the migration
+
+
+
+
+ Set to true to ignore this migration.
+
+
+
+
+ The main interface to use in Migrations to make changes on a database schema.
+
+
+
+
+ Add a column to an existing table
+
+ The name of the table that will get the new column
+ The name of the new column
+ The data type for the new columnd
+ The precision or size of the column
+ Properties that can be ORed together
+ The default value of the column if no value is given in a query
+
+
+
+ Add a column to an existing table
+
+ The name of the table that will get the new column
+ The name of the new column
+ The data type for the new columnd
+
+
+
+ Add a column to an existing table
+
+ The name of the table that will get the new column
+ The name of the new column
+ The data type for the new columnd
+ The precision or size of the column
+
+
+
+ Add a column to an existing table
+
+ The name of the table that will get the new column
+ The name of the new column
+ The data type for the new columnd
+ The precision or size of the column
+ Properties that can be ORed together
+
+
+
+ Add a column to an existing table
+
+ The name of the table that will get the new column
+ The name of the new column
+ The data type for the new columnd
+ Properties that can be ORed together
+
+
+
+ Add a column to an existing table with the default column size.
+
+ The name of the table that will get the new column
+ The name of the new column
+ The data type for the new columnd
+ The default value of the column if no value is given in a query
+
+
+
+ Add a column to an existing table
+
+ The name of the table that will get the new column
+ An instance of a Column with the specified properties
+
+
+
+ Add a foreign key constraint
+
+ The name of the foreign key. e.g. FK_TABLE_REF
+ The table that the foreign key will be created in (eg. Table.FK_id)
+ The columns that are the foreign keys (eg. FK_id)
+ The table that holds the primary keys (eg. Table.PK_id)
+ The columns that are the primary keys (eg. PK_id)
+
+
+
+ Add a foreign key constraint
+
+ The name of the foreign key. e.g. FK_TABLE_REF
+ The table that the foreign key will be created in (eg. Table.FK_id)
+ The columns that are the foreign keys (eg. FK_id)
+ The table that holds the primary keys (eg. Table.PK_id)
+ The columns that are the primary keys (eg. PK_id)
+ Constraint parameters
+
+
+
+ Add a foreign key constraint
+
+
+ The name of the foreign key. e.g. FK_TABLE_REF
+ The table that the foreign key will be created in (eg. Table.FK_id)
+ The column that is the foreign key (eg. FK_id)
+ The table that holds the primary keys (eg. Table.PK_id)
+ The column that is the primary key (eg. PK_id)
+
+
+
+ Add a foreign key constraint
+
+ The name of the foreign key. e.g. FK_TABLE_REF
+ The table that the foreign key will be created in (eg. Table.FK_id)
+ The column that is the foreign key (eg. FK_id)
+ The table that holds the primary key (eg. Table.PK_id)
+ The column that is the primary key (eg. PK_id)
+ Constraint parameters
+
+
+
+ Add a foreign key constraint when you don't care about the name of the constraint.
+ Warning: This will prevent you from dropping the constraint since you won't know the name.
+
+ The table that the foreign key will be created in (eg. Table.FK_id)
+ The column that is the foreign key (eg. FK_id)
+ The table that holds the primary key (eg. Table.PK_id)
+ The column that is the primary key (eg. PK_id)
+
+
+
+ Add a foreign key constraint when you don't care about the name of the constraint.
+ Warning: This will prevent you from dropping the constraint since you won't know the name.
+
+ The table that the foreign key will be created in (eg. Table.FK_id)
+ The columns that are the foreign keys (eg. FK_id)
+ The table that holds the primary key (eg. Table.PK_id)
+ The column that is the primary key (eg. PK_id)
+
+
+
+ Add a foreign key constraint when you don't care about the name of the constraint.
+ Warning: This will prevent you from dropping the constraint since you won't know the name.
+
+ The table that the foreign key will be created in (eg. Table.FK_id)
+ The columns that are the foreign keys (eg. FK_id)
+ The table that holds the primary key (eg. Table.PK_id)
+ The columns that are the primary keys (eg. PK_id)
+ Constraint parameters
+
+
+
+ Add a foreign key constraint when you don't care about the name of the constraint.
+ Warning: This will prevent you from dropping the constraint since you won't know the name.
+
+ The table that the foreign key will be created in (eg. Table.FK_id)
+ The columns that are the foreign keys (eg. FK_id)
+ The table that holds the primary key (eg. Table.PK_id)
+ The column that is the primary key (eg. PK_id)
+ Constraint parameters
+
+
+
+ Add a foreign key constraint when you don't care about the name of the constraint.
+ Warning: This will prevent you from dropping the constraint since you won't know the name.
+
+ The current expectations are that there is a column named the same as the foreignTable present in
+ the table. This is subject to change because I think it's not a good convention.
+
+ The table that the foreign key will be created in (eg. Table.FK_id)
+ The table that holds the primary key (eg. Table.PK_id)
+
+
+
+ Add a foreign key constraint when you don't care about the name of the constraint.
+ Warning: This will prevent you from dropping the constraint since you won't know the name.
+
+ The current expectations are that there is a column named the same as the foreignTable present in
+ the table. This is subject to change because I think it's not a good convention.
+
+ The table that the foreign key will be created in (eg. Table.FK_id)
+ The table that holds the primary key (eg. Table.PK_id)
+
+
+
+
+ Add a primary key to a table
+
+ The name of the primary key to add.
+ The name of the table that will get the primary key.
+ The name of the column or columns that are in the primary key.
+
+
+
+ Add a constraint to a table
+
+ The name of the constraint to add.
+ The name of the table that will get the constraint
+ The name of the column or columns that will get the constraint.
+
+
+
+ Add a constraint to a table
+
+ The name of the constraint to add.
+ The name of the table that will get the constraint
+ The check constraint definition.
+
+
+
+ Add a table
+
+ The name of the table to add.
+ The columns that are part of the table.
+
+
+
+ Add a table
+
+ The name of the table to add.
+ The name of the database engine to use. (MySQL)
+ The columns that are part of the table.
+
+
+
+ Start a transction
+
+
+
+
+ Change the definition of an existing column.
+
+ The name of the table that will get the new column
+ An instance of a Column with the specified properties and the name of an existing column
+
+
+
+ Check to see if a column exists
+
+
+
+
+
+
+
+ Commit the running transction
+
+
+
+
+ Check to see if a constraint exists
+
+ The name of the constraint
+ The table that the constraint lives on.
+
+
+
+
+ Check to see if a primary key constraint exists on the table
+
+ The name of the primary key
+ The table that the constraint lives on.
+
+
+
+
+ Execute an arbitrary SQL query
+
+ The SQL to execute.
+
+
+
+
+ Execute an arbitrary SQL query
+
+ The SQL to execute.
+
+
+
+
+ Execute an arbitrary SQL query
+
+ The SQL to execute.
+ A single value that is returned.
+
+
+
+ Get the information about the columns in a table
+
+ The table name that you want the columns for.
+
+
+
+
+ Get information about a single column in a table
+
+ The table name that you want the columns for.
+ The column name for which you want information.
+
+
+
+
+ Get the names of all of the tables
+
+ The names of all the tables.
+
+
+
+ Insert data into a table
+
+ The table that will get the new data
+ The names of the columns
+ The values in the same order as the columns
+
+
+
+
+ Delete data from a table
+
+ The table that will have the data deleted
+ The names of the columns used in a where clause
+ The values in the same order as the columns
+
+
+
+
+ Delete data from a table
+
+ The table that will have the data deleted
+ The name of the column used in a where clause
+ The value for the where clause
+
+
+
+
+ Marks a Migration version number as having been applied
+
+ The version number of the migration that was applied
+
+
+
+ Marks a Migration version number as having been rolled back from the database
+
+ The version number of the migration that was removed
+
+
+
+ Remove an existing column from a table
+
+ The name of the table to remove the column from
+ The column to remove
+
+
+
+ Remove an existing foreign key constraint
+
+ The table that contains the foreign key.
+ The name of the foreign key to remove
+
+
+
+ Remove an existing constraint
+
+ The table that contains the foreign key.
+ The name of the constraint to remove
+
+
+
+ Remove an existing table
+
+ The name of the table
+
+
+
+ Rename an existing table
+
+ The old name of the table
+ The new name of the table
+
+
+
+ Rename an existing table
+
+ The name of the table
+ The old name of the column
+ The new name of the column
+
+
+
+ Rollback the currently running transaction.
+
+
+
+
+ Get values from a table
+
+ The columns to select
+ The table to select from
+ The where clause to limit the selection
+
+
+
+
+ Get values from a table
+
+ The columns to select
+ The table to select from
+
+
+
+
+ Get a single value from a table
+
+ The columns to select
+ The table to select from
+
+
+
+
+
+ Get a single value from a table
+
+ The columns to select
+ The table to select from
+
+
+
+
+ Check if a table already exists
+
+ The name of the table that you want to check on.
+
+
+
+
+ Update the values in a table
+
+ The name of the table to update
+ The names of the columns.
+ The values for the columns in the same order as the names.
+
+
+
+
+ Update the values in a table
+
+ The name of the table to update
+ The names of the columns.
+ The values for the columns in the same order as the names.
+ A where clause to limit the update
+
+
+
+
+ Get a command instance
+
+
+
+
+
+ Execute a schema builder
+
+
+
+
+
+ Quote a multiple column names, if required
+
+
+
+
+
+
+ Quaote column if required
+
+
+
+
+
+
+ Quote table name if required
+
+
+
+
+
+
+ Encodes a guid value as a string, suitable for inclusion in sql statement
+
+
+
+
+
+
+ Get this provider or a NoOp provider if you are not running in the context of 'provider'.
+
+
+
+
+ The list of Migrations currently applied to the database.
+
+
+
+
+ Logger used to log details of operations performed during migration
+
+
+
+
+ ILogger interface.
+ Implicit in this interface is that the logger will delegate actual
+ logging to the (s) that have been attached
+
+
+
+
+ Attach an
+
+
+
+
+
+ Detach an
+
+
+
+
+
+ Represents a table column.
+
+
+
+
+ Adds a Table to be created to the Schema
+
+ Table name to be created
+ SchemaBuilder for chaining
+
+
+
+ Reference an existing table.
+
+ Table to reference
+ SchemaBuilder for chaining
+
+
+
+ Reference an existing table.
+
+ Table to reference
+ SchemaBuilder for chaining
+
+
+
+ Adds a Column to be created
+
+ Column name to be added
+ IColumnOptions to restrict chaining
+
+
+
+ Text logger for the migration mediator
+
+
+
+
diff --git a/Libraries/Migrator.NET/Migrator.Providers.dll b/Libraries/Migrator.NET/Migrator.Providers.dll
new file mode 100644
index 000000000..85fe26cef
Binary files /dev/null and b/Libraries/Migrator.NET/Migrator.Providers.dll differ
diff --git a/Libraries/Migrator.NET/Migrator.Providers.pdb b/Libraries/Migrator.NET/Migrator.Providers.pdb
new file mode 100644
index 000000000..a9136da55
Binary files /dev/null and b/Libraries/Migrator.NET/Migrator.Providers.pdb differ
diff --git a/Libraries/Migrator.NET/Migrator.Providers.xml b/Libraries/Migrator.NET/Migrator.Providers.xml
new file mode 100644
index 000000000..9b02d1e53
--- /dev/null
+++ b/Libraries/Migrator.NET/Migrator.Providers.xml
@@ -0,0 +1,389 @@
+
+
+
+ Migrator.Providers
+
+
+
+
+ Summary description for SQLiteTransformationProvider.
+
+
+
+
+ Base class for every transformation providers.
+ A 'tranformation' is an operation that modifies the database.
+
+
+
+
+ Add a new table
+
+ Table name
+ Columns
+
+ Adds the Test table with two columns:
+
+ Database.AddTable("Test",
+ new Column("Id", typeof(int), ColumnProperty.PrimaryKey),
+ new Column("Title", typeof(string), 100)
+ );
+
+
+
+
+
+ Add a new table
+
+ Table name
+ Columns
+ the database storage engine to use
+
+ Adds the Test table with two columns:
+
+ Database.AddTable("Test", "INNODB",
+ new Column("Id", typeof(int), ColumnProperty.PrimaryKey),
+ new Column("Title", typeof(string), 100)
+ );
+
+
+
+
+
+ Add a new column to an existing table.
+
+ Table to which to add the column
+ Column name
+ Date type of the column
+ Max length of the column
+ Properties of the column, see ColumnProperty,
+ Default value
+
+
+
+
+ AddColumn(string, string, Type, int, ColumnProperty, object)
+
+
+
+
+
+
+ AddColumn(string, string, Type, int, ColumnProperty, object)
+
+
+
+
+
+
+ AddColumn(string, string, Type, int, ColumnProperty, object)
+
+
+
+
+
+
+ AddColumn(string, string, Type, int, ColumnProperty, object)
+
+
+
+
+
+ Append a primary key to a table.
+
+ Constraint name
+ Table name
+ Primary column names
+
+
+
+ Guesses the name of the foreign key and add it
+
+
+
+
+ Guesses the name of the foreign key and add it
+
+
+
+
+ Guesses the name of the foreign key and add it
+
+
+
+
+ Guesses the name of the foreign key and add it
+
+
+
+
+ Append a foreign key (relation) between two tables.
+ tables.
+
+ Constraint name
+ Table name containing the primary key
+ Primary key column name
+ Foreign table name
+ Foreign column name
+
+
+
+
+ AddForeignKey(string, string, string, string, string)
+
+
+
+
+
+ Determines if a constraint exists.
+
+ Constraint name
+ Table owning the constraint
+ true if the constraint exists.
+
+
+
+ Execute an SQL query returning results.
+
+ The SQL command.
+ A data iterator, IDataReader.
+
+
+
+ Starts a transaction. Called by the migration mediator.
+
+
+
+
+ Rollback the current migration. Called by the migration mediator.
+
+
+
+
+ Commit the current transaction. Called by the migrations mediator.
+
+
+
+
+ Marks a Migration version number as having been applied
+
+ The version number of the migration that was applied
+
+
+
+ Marks a Migration version number as having been rolled back from the database
+
+ The version number of the migration that was removed
+
+
+
+ Returns the event logger
+
+
+
+
+ The list of Migrations currently applied to the database.
+
+
+
+
+ Turn something like 'columnName INTEGER NOT NULL' into just 'columnName'
+
+
+
+
+ Name is the first value before the space.
+
+
+
+
+
+
+ No Op (Null Object Pattern) implementation of the ITransformationProvider
+
+
+
+
+ Defines the implementations specific details for a particular database.
+
+
+
+
+ Subclasses register a typename for the given type code and maximum
+ column length. $l in the type name will be replaced by the column
+ length (if appropriate)
+
+ The typecode
+ Maximum length of database type
+ The database type name
+
+
+
+ Suclasses register a typename for the given type code. $l in the
+ typename will be replaced by the column length (if appropriate).
+
+ The typecode
+ The database type name
+
+
+
+ Get the name of the database type associated with the given
+
+ The DbType
+ The database type name used by ddl.
+
+
+
+ Get the name of the database type associated with the given
+
+ The DbType
+ The database type name used by ddl.
+
+
+
+
+ Get the name of the database type associated with the given
+
+ The DbType
+ The database type name used by ddl.
+
+
+
+
+
+
+ Subclasses register which DbTypes are unsigned-compatible (ie, available in signed and unsigned variants)
+
+
+
+
+
+ Determine if a particular database type has an unsigned variant
+
+ The DbType
+ True if the database type has an unsigned variant, otherwise false
+
+
+
+ Migration transformations provider for Microsoft SQL Server.
+
+
+
+
+ Migration transformations provider for Microsoft SQL Server.
+
+
+
+
+ Migration transformations provider for PostgreSql (using NPGSql .Net driver)
+
+
+
+
+ This is basically a just a helper base class
+ per-database implementors may want to override ColumnSql
+
+
+
+ The SQL type
+
+
+ The name of the column
+
+
+
+ the type of the column
+
+
+
+
+ Sql if This column is Indexed
+
+
+
+
+ Sql if this column has a default value
+
+
+
+
+ The sql for this column, override in database-specific implementation classes
+
+
+
+
+ This class maps a DbType to names.
+
+
+ Associations may be marked with a capacity. Calling the Get()
+ method with a type and actual size n will return the associated
+ name with smallest capacity >= n, if available and an unmarked
+ default type otherwise.
+ Eg, setting
+
+ Names.Put(DbType, "TEXT" );
+ Names.Put(DbType, 255, "VARCHAR($l)" );
+ Names.Put(DbType, 65534, "LONGVARCHAR($l)" );
+
+ will give you back the following:
+
+ Names.Get(DbType) // --> "TEXT" (default)
+ Names.Get(DbType,100) // --> "VARCHAR(100)" (100 is in [0:255])
+ Names.Get(DbType,1000) // --> "LONGVARCHAR(1000)" (100 is in [256:65534])
+ Names.Get(DbType,100000) // --> "TEXT" (default)
+
+ On the other hand, simply putting
+
+ Names.Put(DbType, "VARCHAR($l)" );
+
+ would result in
+
+ Names.Get(DbType) // --> "VARCHAR($l)" (will cause trouble)
+ Names.Get(DbType,100) // --> "VARCHAR(100)"
+ Names.Get(DbType,1000) // --> "VARCHAR(1000)"
+ Names.Get(DbType,10000) // --> "VARCHAR(10000)"
+
+
+
+
+
+ Get default type name for specified type
+
+ the type key
+ the default type name associated with the specified key
+
+
+
+ Get the type name specified type and size
+
+ the type key
+ the SQL length
+ the SQL scale
+ the SQL precision
+
+ The associated name with smallest capacity >= size if available and the
+ default type name otherwise
+
+
+
+
+ Set a type name for specified type key and capacity
+
+ the type key
+ the (maximum) type size/length
+ The associated name
+
+
+
+
+
+
+
+
+
+
+ Summary description for MySqlTransformationProvider.
+
+
+
+
diff --git a/Libraries/Migrator.NET/Migrator.dll b/Libraries/Migrator.NET/Migrator.dll
new file mode 100644
index 000000000..fbcf23e2a
Binary files /dev/null and b/Libraries/Migrator.NET/Migrator.dll differ
diff --git a/Libraries/Migrator.NET/Migrator.pdb b/Libraries/Migrator.NET/Migrator.pdb
new file mode 100644
index 000000000..832d105b1
Binary files /dev/null and b/Libraries/Migrator.NET/Migrator.pdb differ
diff --git a/NzbDrone.Core.Test/DiskScanProviderTest.cs b/NzbDrone.Core.Test/DiskScanProviderTest.cs
index b33778588..386766810 100644
--- a/NzbDrone.Core.Test/DiskScanProviderTest.cs
+++ b/NzbDrone.Core.Test/DiskScanProviderTest.cs
@@ -5,6 +5,7 @@
using FluentAssertions;
using Moq;
using NUnit.Framework;
+using NzbDrone.Core.Model;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.Core;
using NzbDrone.Core.Repository;
@@ -18,76 +19,12 @@ namespace NzbDrone.Core.Test
public class DiskScanProviderTest : TestBase
{
[Test]
- public void import_new_file()
+ public void import_new_file_should_succeed()
{
- //Arrange
- /////////////////////////////////////////
+ const string newFile = @"WEEDS.S03E01.DUAL.dvd.HELLYWOOD.avi";
- //Constants
- const string fileName = @"WEEDS.S03E01.DUAL.BDRip.XviD.AC3.-HELLYWOOD.avi";
- const int seasonNumber = 3;
- const int episodeNumner = 1;
- const int size = 12345;
-
- //Fakes
var fakeSeries = Builder.CreateNew().Build();
- var fakeEpisode = Builder.CreateNew()
- .With(c => c.SeriesId = fakeSeries.SeriesId)
- .With(c => c.SeasonNumber = seasonNumber)
- .Build();
-
- //Mocks
- var mocker = new AutoMoqer();
-
- mocker.GetMock()
- .Setup(e => e.GetSize(fileName)).Returns(12345).Verifiable();
-
- var database = mocker.GetMock(MockBehavior.Strict);
- database.Setup(r => r.Exists(It.IsAny(), It.IsAny