Ejemplo n.º 1
0
        public void TestInvalidPathCharactersAreRemoved(string seriesName)
        {
            var arguments = TestArguments.Default;

            arguments.Target = Path.Combine(TestArguments.DefaultTarget, TestFiles.SingleSeries[0]);

            var options = TestOptions.Default;

            options.Series = new[] { TestOptions.SingleSeries };

            var client = new TestClient();

            client.SeriesInfos[TestClient.SingleSeriesId].Name = seriesName;

            TestFiles.CreateFiles(TestArguments.DefaultTarget, TestFiles.SingleSeries);

            var copier  = new Copier(arguments, client, options);
            var matches = copier.CopyFiles().Result;

            Assert.Equal(1, matches);

            var outputFile = Path.Combine(TestOptions.DefaultCollection, OutputFiles.SingleSeries[0]);

            Assert.True(File.Exists(outputFile));
        }
Ejemplo n.º 2
0
        public void TestAllFiles()
        {
            var arguments = TestArguments.Default;
            var options   = TestOptions.Default;
            var client    = new TestClient();

            TestFiles.CreateFiles(TestArguments.DefaultTarget, TestFiles.SingleSeries, TestFiles.DoubleSeries, TestFiles.LongSeries);

            var copier  = new Copier(arguments, client, options);
            var matches = copier.CopyFiles().Result;

            Assert.Equal(TestFiles.SingleSeries.Length + TestFiles.DoubleSeries.Length + TestFiles.LongSeries.Length, matches);

            ValidateFiles(options.Collection, OutputFiles.SingleSeries, OutputFiles.DoubleSeries, OutputFiles.LongSeries);
        }
Ejemplo n.º 3
0
        private void TestWhetherFileIsReplacedBasedOnSeriesOptions(
            bool?SeriesReplaceExisting,
            bool?PatternReplaceExisting,
            bool shouldBeReplaced)
        {
            var arguments = TestArguments.Default;
            var options   = TestOptions.Default;
            var client    = new TestClient();

            foreach (var series in options.Series)
            {
                series.ReplaceExisting = SeriesReplaceExisting;
                foreach (var pattern in series.Patterns)
                {
                    pattern.ReplaceExisting = PatternReplaceExisting;
                }
            }

            TestFiles.CreateFiles(TestArguments.DefaultTarget, TestFiles.SingleSeries);

            var outputFile      = Path.Combine(TestOptions.DefaultCollection, OutputFiles.SingleSeries[0]);
            var initialContents = TestFiles.CreateFile(outputFile);

            var copier  = new Copier(arguments, client, options);
            var matches = copier.CopyFiles().Result;

            Assert.Equal(TestFiles.SingleSeries.Length, matches);

            ValidateFiles(options.Collection, OutputFiles.SingleSeries);

            var finalContents = File.ReadAllText(outputFile);

            if (!shouldBeReplaced)
            {
                Assert.Equal(initialContents, finalContents);
            }
            else
            {
                Assert.NotEqual(initialContents, finalContents);
            }
        }
Ejemplo n.º 4
0
        public void TestMovieFile()
        {
            var arguments = TestArguments.Default;

            var options = TestOptions.Default;

            options.Series = new[] { TestOptions.MovieSpecial };

            var client = new TestClient();

            TestFiles.CreateFiles(TestArguments.DefaultTarget, TestFiles.SeriesWithSpecials);

            var copier  = new Copier(arguments, client, options);
            var matches = copier.CopyFiles().Result;

            Assert.Equal(1, matches);

            var outputFile = Path.Combine(TestOptions.DefaultCollection, OutputFiles.SingleMovie[0]);

            Assert.True(File.Exists(outputFile));
        }
Ejemplo n.º 5
0
        public void TestSingleFileDoesNotMatch()
        {
            var arguments = TestArguments.Default;

            arguments.Target = Path.Combine(TestArguments.DefaultTarget, TestFiles.SingleSeries[0]);

            var options = TestOptions.Default;

            options.Series = new[] { TestOptions.LongSeries };

            var client = new TestClient();

            TestFiles.CreateFiles(TestArguments.DefaultTarget, TestFiles.SingleSeries);

            var copier  = new Copier(arguments, client, options);
            var matches = copier.CopyFiles().Result;

            Assert.Equal(0, matches);

            ValidateFiles(options.Collection);
        }