public void CoordinatorWorksOnFileSystemStorage()
        {
            var storage = new FileSystemStorage(@"c:\temp\netreduce", eraseContents: true) as IStorage;

            storage.Store(Base64.Encode("f1"), "ala ma kota");
            storage.Store(Base64.Encode("f2"), "kota alama");
            storage.Store(Base64.Encode("f3"), "dolan ma");
            var filesToRead = storage.ListFiles();
            var mapperCodeFile = new Uri("file:///SampleMapper.cs");
            var reducerCodeFile = new Uri("file:///SampleReducer.cs");
            TestHelpers.LoadToStorage(@"..\..\SampleMapper.cs", mapperCodeFile, storage);
            TestHelpers.LoadToStorage(@"..\..\SampleReducer.cs", reducerCodeFile, storage);
            var coordinator = new Coordinator<ThreadWorker>(storage);

            coordinator.Start(2, 2, mapperCodeFile, reducerCodeFile, filesToRead);

            string result = string.Empty;
            foreach (var uri in storage.ListFiles())
            {
                var file = this.storage.GetFileName(uri);
                if (file.Contains("REDUCE") && file.Contains(Base64.Encode("kota")))
                {
                    result = storage.Read(file);
                }
            }

            result.ShouldBe("2");
        }
        public void FileSystemStorageRemoveDeletesGivenFile()
        {
            var storage = new FileSystemStorage(@"c:\temp\netreduce", eraseContents: true);
            storage.Store("a", "aa");
            storage.Store("b", "bb");
            var fileToRemove = storage.ListFiles().First(u => u.OriginalString.Contains("a"));

            storage.Remove(fileToRemove);

            var noOfFiles = storage.ListFiles().Count();
            noOfFiles.ShouldBe(1);
            storage.ListFiles().First().OriginalString.ShouldContain("b");
        }
        public void FileSystemStoragCleanMethodDeletesAllFiles()
        {
            var storage = new FileSystemStorage(@"c:\temp\netreduce", eraseContents: true);
            storage.Store("a", "aa");
            storage.Store("b", "bb");

            storage.Clean();
            var noOfFiles = storage.ListFiles().Count();

            noOfFiles.ShouldBe(0);
        }