Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using DuplicateFinder.Core.Commands;
- using Machine.Specifications;
- namespace DuplicateFinder.Core.Integration.Tests {
- public class FindingDuplicates {
- It can_find_files_with_the_same_size =()=> {
- RunCommand(@"--size --whatif Samples\First Samples\Second");
- AllDuplicates.ShouldContainOnly(@"Samples\First\content-full-first.txt",
- @"Samples\Second\content-full-second.txt",
- @"Samples\First\size-first.txt",
- @"Samples\Second\size-second.txt");
- };
- It can_find_files_with_the_same_name =()=> {
- RunCommand(@"--name --whatif Samples\First Samples\Second");
- AllDuplicates.ShouldContainOnly(@"Samples\First\name.txt", @"Samples\Second\name.txt");
- };
- It can_find_files_with_the_same_contents =()=> {
- RunCommand(@"--content --whatif Samples\First Samples\Second");
- AllDuplicates.ShouldContainOnly(@"Samples\First\content-full-first.txt", @"Samples\Second\content-full-second.txt");
- };
- It can_find_files_with_the_same_head_content =()=> {
- RunCommand(@"--content --first 5 --whatif Samples\First Samples\Second");
- AllDuplicates.ShouldContainOnly(@"Samples\First\content-full-first.txt",
- @"Samples\Second\content-full-second.txt",
- @"Samples\First\content-head-first.txt",
- @"Samples\Second\content-head-second.txt");
- };
- It can_find_files_with_the_same_tail_content =()=> {
- RunCommand(@"--content --last 5 --whatif Samples\First Samples\Second");
- AllDuplicates.ShouldContainOnly(@"Samples\First\content-full-first.txt",
- @"Samples\Second\content-full-second.txt",
- @"Samples\First\content-tail-first.txt",
- @"Samples\Second\content-tail-second.txt");
- };
- It can_find_files_with_the_same_head_and_tail_content =()=> {
- RunCommand(@"--content --first 5 --last 5 --whatif Samples\First Samples\Second");
- AllDuplicates.ShouldContainOnly(@"Samples\First\content-full-first.txt", @"Samples\Second\content-full-second.txt");
- }
- // Helpers
- static ICommand Command;
- static ICommand RunCommand(string command) {
- var args = command.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
- Command = new CommandLineParser().Parse(args);
- Command.Execute();
- return Command;
- }
- static IEnumerable<string> AllDuplicates {
- get { return (Command as FindDuplicatesCommand).Duplicates.SelectMany(x => x); }
- }
- }
- }
Add Comment
Please, Sign In to add comment