private static void ConfigureTask(CopyTaskBuilder sut)
 {
     sut.With("Id", TaskId)
     .With("Name", TaskName)
     .With("CopyFromPath", TheSourcePath)
     .With("CopyToPath", TheDestPath)
     .With("CopySubfolders", Recursive)
     .With("CopyFileByPattern", FilePattern)
     .With("AlwaysOverwrite", AlwaysOverwrite);
 }
        GivenSourcePathDestPathRecursiveAndFilePattern__WhenCallingBuild__ShouldReturnCopyTaskWithMatchingConfig()
        {
            CopyTaskBuilder sut = new CopyTaskBuilder(new CopyPolicyDummy(), new MockFileSystem());

            ConfigureTask(sut);

            CopyTask task = (CopyTask)sut.Build();

            Assert.AreEqual(TaskId, task.Id);
            Assert.AreEqual(TaskName, task.Name);
            Assert.AreEqual(TheSourcePath, task.Source);
            Assert.AreEqual(TheDestPath, task.Destination);
            Assert.AreEqual(FilePattern, task.FilePattern);
            Assert.AreEqual(AlwaysOverwrite, task.AlwaysOverwrite);
            Assert.IsTrue(task.Recursive);
        }
        public void GivenTaskBuiltWithValidConfiguration__WhenRunningTask__ShouldCopyPolicyShouldBeCalled()
        {
            MockFileSystem fileSystem = new MockFileSystem(new Dictionary <string, MockFileData>
            {
                { TheSourcePath, string.Empty }
            });
            CopyPolicySpy copyPolicySpy = new CopyPolicySpy();

            CopyTaskBuilder sut = new CopyTaskBuilder(copyPolicySpy, fileSystem);

            ConfigureTask(sut);
            CopyTask task = (CopyTask)sut.Build();

            task.Run();

            Assert.IsTrue(copyPolicySpy.CopyCalled);
        }
        public void WhenCallingWith_WithInvalidConfigOption__ShouldThrowInvalidOperationException()
        {
            CopyTaskBuilder sut = new CopyTaskBuilder(new CopyPolicyDummy(), new MockFileSystem());

            sut.With("InvalidOption", string.Empty);
        }