Inheritance: IFileSystem, IMockFileDataAccessor
        public void CopyFiles_Copies_files_to_destinationFolder()
        {
            // Arrange
            var filesSystem = new MockFileSystem(new Dictionary<string, MockFileData>
            {
                {@"c:\Temp\Folder\1.txt", new MockFileData(string.Empty)},
                {@"c:\Temp\Folder\2.txt", new MockFileData(string.Empty)},
                {@"c:\Temp\Folder\SubFolder\3.txt", new MockFileData(string.Empty)},
                {@"c:\Temp\Folder\SubFolder\4.txt", new MockFileData(string.Empty)},

                {@"d:\Destination\", new MockDirectoryData()},
            });

            var fileSystemHelper = new FileSystemHelper(filesSystem);

            // Act
            var filesToCopy = fileSystemHelper.GetFiles(@"c:\Temp\", "*.*");
            fileSystemHelper.CopyFiles(filesToCopy, @"D:\Destination\", force: false);

            // Assert
            filesSystem.AllFiles.Contains(new List<string>
            {
                @"d:\Destination\Folder\1.txt",
                @"d:\Destination\Folder\2.txt",
                @"d:\Destination\Folder\SubFolder\3.txt",
                @"d:\Destination\Folder\SubFolder\4.txt",
            }, StringComparer.InvariantCultureIgnoreCase);
        }
        public void CopyFiles_if_force_is_true_and_destinationPath_does_not_exist_creates_destinationFolder()
        {
            // Arrange
            var filesSystem = new MockFileSystem(new Dictionary<string, MockFileData>
            {
                {@"c:\Temp\Folder\1.txt", new MockFileData(string.Empty)},
                {@"c:\Temp\Folder\2.txt", new MockFileData(string.Empty)},
                {@"c:\Temp\Folder\SubFolder\3.txt", new MockFileData(string.Empty)},
                {@"c:\Temp\Folder\SubFolder\4.txt", new MockFileData(string.Empty)},
            });

            var fileSystemHelper = new FileSystemHelper(filesSystem);

            // Act
            var filesToCopy = fileSystemHelper.GetFiles(@"c:\Temp\", "*.*");
            fileSystemHelper.CopyFiles(filesToCopy, @"C:\Destination\Documents\", force: true);

            // Assert
            filesSystem.AllFiles.Contains(new List<string>
            {
                @"c:\Destination\Documents\Folder\1.txt",
                @"c:\Destination\Documents\Folder\2.txt",
                @"c:\Destination\Documents\Folder\SubFolder\3.txt",
                @"c:\Destination\Documents\Folder\SubFolder\4.txt",
            }, StringComparer.InvariantCultureIgnoreCase);
        }
Example #3
0
        public void Should_Compile_Less_To_Css_To_Output_Path()
        {
            var lessContent = @"@brand_color: #4D926F;

                                    #header {
                                        color: @brand_color;
                                    }

                                    h2 {
                                        color: @brand_color;
                                    }";

            var lessOutput = @"#header{color:#4d926f}h2{color:#4d926f}";

            var filepath = @"c:\css\style.less";
            var fileSystem = new MockFileSystem(new Dictionary<string, MockFileData>
            {
                { filepath, new MockFileData(lessContent) }
            });

            var files = new List<FileInfo>() { new FileInfo(filepath) };

            var factory = new TestContainerFactory();
            var engine = factory.GetEngine(fileSystem, @"c:\css");

            var minifier = new CssMinifier(fileSystem, files, _outputPath, () => engine);
            minifier.Minify();

            var minifiedFile = fileSystem.File.ReadAllText(_outputPath, Encoding.UTF8);

            Assert.Equal(lessOutput, minifiedFile);
        }
Example #4
0
        public void Should_Combine_Files_To_Output_Path()
        {
            var filepath1 = @"c:\css\style.css";
            var filepath2 = @"c:\css\style2.css";

            var fileSystem = new MockFileSystem(new Dictionary<string, MockFileData>
            {
                { filepath1, new MockFileData("a { color: Red; }") },
                { filepath2, new MockFileData("a { color: Blue; }") }
            });

            var files = new List<FileInfo> { new FileInfo(filepath1), new FileInfo(filepath2) };

            var factory = new TestContainerFactory();
            var engine = factory.GetEngine(fileSystem, @"c:\css");

            var minifier = new CssMinifier(fileSystem, files, _outputPath, () => engine);
            minifier.Minify();

            var expectedOutput = @"a{color:Red}a{color:Blue}";

            var minifiedFile = fileSystem.File.ReadAllText(_outputPath, Encoding.UTF8);

            Assert.Equal(expectedOutput, minifiedFile);
        }
        public void SetUp()
        {
            var stream_website = Assembly.GetExecutingAssembly().GetManifestResourceStream("Bankleitzahlen.Bundesbank.Tests.Resources.bankleitzahlen_download.html");
            var stream_änderungsdatei = Assembly.GetExecutingAssembly().GetManifestResourceStream("Bankleitzahlen.Bundesbank.Tests.Resources.blz_2015_09_07_txt.txt");

            var webclientMock = new Mock<IWebClient>();
            webclientMock.Setup(client => client.OpenReadTaskAsync(It.Is<Uri>(uri => uri == BankleitzahlenänderungsdateiService.BankleitzahlenänderungsdateiUri))).ReturnsAsync(stream_website);
            webclientMock.Setup(client => client.OpenReadTaskAsync(It.Is<Uri>(uri => uri == new Uri("https://foo.bla/blz_2015_09_07_txt.txt")))).ReturnsAsync(stream_änderungsdatei);

            var webclientFactoryMock = new Mock<IWebClientFactory>();
            webclientFactoryMock.Setup(factory => factory.CreateWebClient()).Returns(webclientMock.Object);

            var fileSystemMock = new MockFileSystem(new Dictionary<string, MockFileData>
                {
                    { @"c:\data\Bundesbankänderungsdateien\blz_2015_09_07_txt.txt", new MockFileData(
@"100305001Bankhaus Löbbecke                                         10117Berlin                             Bankhaus Löbbecke Berlin   26225LOEBDEBBXXX09043961U000000000
100306001North Channel Bank                                        55118Mainz a Rhein                      North Channel Bank Mainz   26205GENODEF1OGK88000532U000000000
100307001Eurocity Bank                                             60311Frankfurt am Main                  Eurocity Bank              26535DLGHDEB1XXX16044339U000000000", Encoding.GetEncoding(1252)) }
                });

            //_service = new BankleitzahlenänderungsdateiService(fileSystemMock);
            _service = new BankleitzahlenänderungsdateiService();
            _service.WebClientFactory = webclientFactoryMock.Object;
            _service.FileSystem = fileSystemMock;
        }
        public void ExtractSnippet()
        {
            // Declare content
            const string content =
            @"Some
            Content
            Here";
            // Mock file system
            IFileSystem fileSystem = new MockFileSystem(new Dictionary<string, MockFileData>
            {
                { "Content.txt", new MockFileData(content) }
            });

            // Run the extraction
            DefaultSnippetExtractor extractor = new DefaultSnippetExtractor();
            FileInfoBase fileInfoBase = fileSystem.FileInfo.FromFileName("Content.txt");
            Extension.Model.PlainTextSnippet snippet = extractor.Extract(fileInfoBase, null) as Extension.Model.PlainTextSnippet;

            // Load the expected file content
            MemoryStream memoryStream = new MemoryStream();
            using (var fileReader = new StreamReader(fileInfoBase.OpenRead()))
            using (var fileWriter = new StreamWriter(memoryStream))
            {
                fileWriter.Write(fileReader.ReadToEnd());
            }

            // Assert
            Assert.AreEqual(content, snippet.Text);
        }
        public void Should_Compile_Single_Less_File()
        {
            var lessContent = @"@brand_color: #4D926F;

                                    #header {
                                        color: @brand_color;
                                    }
 
                                    h2 {
                                        color: @brand_color;
                                    }";

            var lessOutput = @"#header{color:#4d926f}h2{color:#4d926f}";

            var filepath = @"c:\css\style.less";
            var fileSystem = new MockFileSystem(new Dictionary<string, MockFileData>
            {
                { HtmlFilePath, new MockFileData(PageContent)},
                { filepath, new MockFileData(lessContent) }
            });

            var minifier = new LessTransform(fileSystem);
            var context = new SiteContext { SourceFolder = @"C:\", OutputFolder = @"C:\_site" };
            context.Pages.Add(new NonProcessedPage { OutputFile = HtmlFilePath, Content = PageContent });
            context.Pages.Add(new NonProcessedPage { OutputFile = filepath, Content = lessContent, Filepath = filepath });
            minifier.Transform(context);

            var minifiedFile = fileSystem.File.ReadAllText(@"c:\css\style.css", Encoding.UTF8);
            Assert.Equal(lessOutput, minifiedFile);
        }
Example #8
0
 public void It_should_store_result_after_http_lookup()
 {
     IFileSystem mockFileSystem = new MockFileSystem();
     ratingService.GetRatingWithCache("tt0061811", new MockHttpService(OmdbapiResult), mockFileSystem);
     string expectedPath = Path.Combine(Raticon.Constants.CommonApplicationDataPath, "Cache", "tt0061811.json");
     Assert.IsTrue(mockFileSystem.File.Exists(expectedPath));
 }
        public async Task NoDeliveriesFound_DoesntRequireHost()
        {
            var provider = Substitute.For<ISqlSyntaxProvider>();
            provider.DoesTableExist(Arg.Any<Database>(), Arg.Any<string>()).Returns(true);

            SqlSyntaxContext.SqlSyntaxProvider = provider;

            var settings = Substitute.For<IChauffeurSettings>();
            string s;
            settings.TryGetChauffeurDirectory(out s).Returns(x =>
            {
                x[0] = @"c:\foo";
                return true;
            });

            var conn = Substitute.For<IDbConnection>();
            var db = new Database(conn);

            var writer = new MockTextWriter();

            var fs = new MockFileSystem(new Dictionary<string, MockFileData>
            {
                {@"c:\foo\bar.txt", new MockFileData("This is not a deliverable")}
            });

            var deliverable = new DeliveryDeliverable(null, writer, db, settings, fs, null);

            await deliverable.Run(null, null);

            Assert.That(writer.Messages.Count(), Is.EqualTo(1));
        }
        public void Should_Combine_Files_To_Output_Path()
        {
            var filepath1 = @"c:\css\script1.js";
            var script1 = @"function test() { alert('hello'); }";

            var filepath2 = @"c:\css\script2.css";
            var script2 = @"document.write('<h1>This is a heading</h1>');
document.write('<p>This is a paragraph.</p>');
document.write('<p>This is another paragraph.</p>');";

            var fileSystem = new MockFileSystem(new Dictionary<string, MockFileData>
            {
                { filepath1, new MockFileData(script1) },
                { filepath2, new MockFileData(script2) }
            });

            var files = new List<FileInfo> { new FileInfo(filepath1), new FileInfo(filepath2) };

            var minifier = new JsMinifier(fileSystem, files, _outputPath);
            minifier.Minify();

            var expectedOutput = "function test(){alert(\"hello\")}document.write(\"<h1>This is a heading<\\/h1>\");document.write(\"<p>This is a paragraph.<\\/p>\");document.write(\"<p>This is another paragraph.<\\/p>\")";

            var minifiedFile = fileSystem.File.ReadAllText(_outputPath, Encoding.UTF8);

            Assert.Equal(expectedOutput, minifiedFile);
        }
        public void InstallWithPowershellFile()
        {
            RetrieveFileDataForTestStep testFileLocation = index => @"c:\a\b";
            UploadReportFilesForTestStep uploader = (index, upload) => { };

            var fileSystem = new MockFileSystem(
                new Dictionary<string, MockFileData>
                    {
                        { @"c:\a\b\c.ps1", new MockFileData("Out-Host -InputObject 'hello word'") }
                    });

            var sectionBuilder = new Mock<ITestSectionBuilder>();
            var diagnostics = new SystemDiagnostics((p, s) => { }, null);
            var installer = new ScriptExecuteTestStepProcessor(
               testFileLocation,
               uploader,
               diagnostics,
               fileSystem,
               sectionBuilder.Object);

            var data = new ScriptExecuteTestStep
            {
                pk_TestStepId = 1,
                Order = 2,
                ScriptLanguage = ScriptLanguage.Powershell,
            };

            var result = installer.Process(data, new List<InputParameter>());
            Assert.AreEqual(TestExecutionState.Passed, result);
        }
        public void ParsePropertiesFile_RealFile_Parsed()
        {
            var resource = new EmbeddedResourceReader().GetResource("PropertiesFile.txt");

            // Arrange
            var mockFileSystem = new MockFileSystem();
            var propertiesFile = @"C:\BuildAgent\temp\buildTmp\teamcity.build322130465402584030.properties";
            mockFileSystem.AddFile(propertiesFile, resource);

            var propertiesFileParser = new PropertiesFileParser(mockFileSystem);

            // Act
            var dictionary = propertiesFileParser.ParsePropertiesFile(propertiesFile);

            // Assert
            dictionary["agent.home.dir"].Should().Be(@"C:\BuildAgent");
            dictionary["agent.name"].Should().Be(@"BUILDS8");
            dictionary["agent.ownPort"].Should().Be(@"9090");
            dictionary["agent.work.dir"].Should().Be(@"C:\BuildAgent\work");
            dictionary["build.number"].Should().Be(@"4");
            dictionary["FxCopRoot"].Should()
                .Be(@"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Team Tools\Static Analysis Tools\FxCop");
            dictionary["teamcity.agent.dotnet.agent_url"].Should().Be(@"http://*****:*****@"TeamCityBuildId=781682");
        }
        public void ReadAllPaths_WhenSomeAreEmpty_ReturnsOnlyNonEmptyPaths()
        {
            // Arrange
            string[] sourceFolderPaths = {
                @"C:\Users\Kevin\Documents\Cloud Backup Test",
                @" ",
                @"  ",
                @"C:\Users\Kevin\Documents\LINQPad Queries"
            };

            string contents =
                sourceFolderPaths[0] + Environment.NewLine +
                sourceFolderPaths[1] + Environment.NewLine +
                sourceFolderPaths[2] + Environment.NewLine +
                sourceFolderPaths[3];

            string[] expected = {
                @"C:\Users\Kevin\Documents\Cloud Backup Test",
                @"C:\Users\Kevin\Documents\LINQPad Queries"
            };

            var fileSystem = new MockFileSystem(new Dictionary<string, MockFileData>
            {
                { SourceFolderPathsFilePath, new MockFileData(contents) },
            });

            // Act
            var actor =
                ActorOfAsTestActorRef<CloudBackupActor>(Props.Create(() => new CloudBackupActor(SourceFolderPathsFilePath, fileSystem)))
                .UnderlyingActor;

            // Assert
            CollectionAssert.AreEqual(expected, actual: actor.SourceFolderPaths);
        }
        public void Posts_Are_Imported()
        {
            var fileSystem = new MockFileSystem(new Dictionary<string, MockFileData>
            {
                { ImportFile, new MockFileData(ImportContent) }
            });

            var wordpressImporter = new WordpressImportSql(fileSystem, BaseSite, ImportFile);
            wordpressImporter.Import();

            Assert.True(fileSystem.File.Exists(BaseSite + "_posts\\2010-09-28-about.md"));
            Assert.True(fileSystem.File.Exists(BaseSite + "_posts\\2010-12-07-recyclez-votre-vieux-pc-avec-jolicloud-1-1.md"));
            Assert.True(fileSystem.AllPaths.Count() == 3);
            var postContentAbout = fileSystem.File.ReadAllText(BaseSite + "_posts\\2010-09-28-about.md");
            var headerAbout = postContentAbout.YamlHeader();

            Assert.Equal("About", headerAbout["title"].ToString());

            var postContentJolicloud = fileSystem.File.ReadAllText(BaseSite + "_posts\\2010-12-07-recyclez-votre-vieux-pc-avec-jolicloud-1-1.md");
            var headerJolicloud = postContentJolicloud.YamlHeader();

            Assert.Equal("Recyclez votre vieux PC avec Jolicloud 1.1", headerJolicloud["title"].ToString());
            Assert.NotNull(headerJolicloud["tags"]);
            Assert.NotNull(headerJolicloud["categories"]);
        }
        public static void Initialize(TestContext c)
        {
            var mockFileSystem = new MockFileSystem(new Dictionary<string, MockFileData>
                                                        {
                                                            {
                                                                SourcePath1,
                                                                new MockFileData(string.Empty)
                                                                    {
                                                                        LastAccessTime =
                                                                            DateTime.Now
                                                                    }
                                                            },
                                                            {
                                                                SourcePath2,
                                                                new MockFileData(string.Empty)
                                                                    {
                                                                        LastAccessTime =
                                                                            DateTime.Now
                                                                                    .AddHours(1)
                                                                    }
                                                            },
                                                        });

            AssemblyFinderHelper.FileSystem = mockFileSystem;
        }
Example #16
0
            public void Files_and_Folders_Are_Created()
            {
                _fileSystem = new MockFileSystem(new Dictionary<string, MockFileData>());
                var recipe = new Logic.Recipe(_fileSystem, "Liquid", _baseSite);

                var result = recipe.Create();

                Assert.True(_fileSystem.Directory.Exists(_baseSite + @"_posts\"));
                Assert.True(_fileSystem.Directory.Exists(_baseSite + @"_layouts\"));
                Assert.True(_fileSystem.Directory.Exists(_baseSite + @"css\"));
                Assert.True(_fileSystem.Directory.Exists(_baseSite + @"img\"));

                Assert.True(_fileSystem.File.Exists(_baseSite + "rss.xml"));
                Assert.True(_fileSystem.File.Exists(_baseSite + "atom.xml"));
                Assert.True(_fileSystem.File.Exists(_baseSite + @"_layouts\layout.html"));
                Assert.True(_fileSystem.File.Exists(_baseSite + @"_layouts\post.html"));
                Assert.True(_fileSystem.File.Exists(_baseSite + "index.md"));
                Assert.True(_fileSystem.File.Exists(_baseSite + "about.md"));
                Assert.True(_fileSystem.File.Exists(_baseSite + string.Format(@"_posts\{0}-myfirstpost.md", DateTime.Today.ToString("yyyy-MM-dd"))));
                Assert.True(_fileSystem.File.Exists(_baseSite + @"css\style.css"));
                Assert.True(_fileSystem.File.Exists(_baseSite + @"img\25.png"));
                Assert.True(_fileSystem.File.Exists(_baseSite + @"img\favicon.png"));
                Assert.True(_fileSystem.File.Exists(_baseSite + @"img\logo.png"));
                Assert.True(_fileSystem.File.Exists(_baseSite + @"img\favicon.ico"));

                Assert.Equal(result, "Pretzel site template has been created");
            }
        public void Setup()
        {
            _mocker = new AutoMoqer();

            var mockFileSystem = new MockFileSystem();
            _mocker.SetInstance<IFileSystem>(mockFileSystem);

            // GetMock of the abstract class before create to prevent automoq bugs
            _mocker.GetMock<FileSystemWatcherBase>();

            _instance = _mocker.Create<DirectoryWatcher>();

            // Mocked files
            var content = new byte[] {1, 1, 1};
            _expectedFileLength = content.Length;
            _expectedWriteDate = DateTime.Now.ToUniversalTime();

            var nameWithPath = mockFileSystem.Path.Combine(Path, FileName);
            mockFileSystem.AddFile(nameWithPath, new MockFileData(content)
            {
                LastWriteTime = _expectedWriteDate
            });

            _trackedFile = new TrackedFile();
            _mocker.GetMock<ITrackedFileStore>()
                   .Setup(x => x.GetTrackedFileByFullPath(nameWithPath))
                   .Returns(_trackedFile);
        }
        public void ShouldPatchLinesInBaseBatThatCallJavaDirectly()
        {
            // Arrange
            const string badFileContent = @"
foo
java bar

baz qak java qoo
ajava";
            var fileSystem = new MockFileSystem(new Dictionary<string, MockFileData>
            {
                { @"c:\temp\neo4j\neo-v1234\bin\neo4j.bat", new MockFileData("foo") },
                { @"c:\temp\neo4j\neo-v1234\bin\base.bat", new MockFileData(badFileContent) }
            });
            var server = new NeoServer(new NeoServerConfiguration(), null, null, fileSystem, null);
            server.Context.NeoBasePath = @"c:\temp\neo4j\neo-v1234\";

            // Act
            server.ApplyWorkaroundForJavaResolutionIssue();

            // Assert
            const string goodFileContent = @"
foo
""%javaPath%\bin\java.exe"" bar

baz qak java qoo
ajava";
            var content = fileSystem.File.ReadAllText(@"c:\temp\neo4j\neo-v1234\bin\base.bat");
            Assert.Equal(goodFileContent, content);
        }
Example #19
0
 public void Should_pick_unity_csharp_solution_in_folder_mode()
 {
     var fs = new MockFileSystem();
     fs.File.WriteAllText("Unity.sln", "");
     fs.File.WriteAllText("Unity-csharp.sln", "");
     var solution = new SolutionPicker(fs).LoadSolution(@".", new Logger(Verbosity.Verbose));
     fs.FileInfo.FromFileName (solution.FileName).Name.ShouldEqual("Unity-csharp.sln");
 }
Example #20
0
        public static IFileSystem MediaFileSystemForItemNumber(Dictionary<string, MockFileData> files)
        {
            const string itemNumber = "0101-15001";

            var fileSystem = new MockFileSystem(files);

            return fileSystem;
        }
Example #21
0
        public void TestInitialize()
        {
            adapterConfig = new DictionaryAdapterFactory().GetAdapter<IAdapterConfiguration>(ConfigurationManager.AppSettings);
            fileSystem = new MockFileSystem();

            imageDirectory = string.Format(adapterConfig.PackageSourceDirectory, JobIdentifier);
            targetDirectory = string.Format(@"{0}\{1}", adapterConfig.ImagePath, BatchNumber.Substring(0, 5));
        }
Example #22
0
        public ConfigurationTests()
        {
            var fileSystem = new MockFileSystem();
            fileSystem.AddFile(@"C:\WebSite\_config.yml", new MockFileData(SampleConfig));

            _sut = new Configuration(fileSystem, @"C:\WebSite");
            _sut.ReadFromFile();
        }
Example #23
0
 public void TestAddEntryNoItemsOrProvider()
 {
     var fileSystem = new MockFileSystem(new Dictionary<string, MockFileData> {
         {  FileSystemConfigPath, new MockFileData("") }
     });
     var db = new Database(fileSystem);
     Assert.IsTrue(db.AddEntry("FileSystem", @"c:\APath\", p => false));
 }
        public void PomodoroFileStorage_NoFileNameSuppliedAndFileDoesntExist_CreatesFile()
        {
            var fileSystem = new MockFileSystem(new Dictionary<string, MockFileData>()

            );
            PomodoroFileStorage fs = new PomodoroFileStorage(fileSystem);

            Assert.AreEqual(fileSystem.AllFiles.Count(), 1);
        }
Example #25
0
            public void Razor_Engine_returns_error()
            {
                _fileSystem = new MockFileSystem(new Dictionary<string, MockFileData>());
                var recipe = new Logic.Recipe(_fileSystem, "Razor", _baseSite);

                var result = recipe.Create();

                Assert.Equal(result, "Razor templating hasn't been implemented yet");
            }
Example #26
0
        public void CachingFilmLookup_doesnt_use_http_if_nfo_is_present()
        {
            IFileSystem mockFileSystem = new MockFileSystem(new Dictionary<string, MockFileData> {
                {@"C:\Trailers\Italian Job\Italian.Job_imdb_.nfo", new MockFileData(@"http://www.imdb.com/title/tt0064505/")}
            });

            //AssertDontCallHttpService
            new CachingFilmLookupService(@"C:\Trailers\Italian Job", mockFileSystem, new AssertDontCallHttpService()).Lookup("Italian Job", null);
        }
Example #27
0
        public void additional_ingredients_not_mixed_in_for_other_engine()
        {
            fileSystem = new MockFileSystem(new Dictionary<string, MockFileData>());
            var additionalIngredient = Substitute.For<IAdditionalIngredient>();
            var recipe = new Logic.Recipe.Recipe(fileSystem, "Musak", BaseSite, new[] { additionalIngredient }, false, false);
            recipe.Create();

            additionalIngredient.DidNotReceive().MixIn(BaseSite);
        }
Example #28
0
        public void can_mixin_additional_ingredients_for_razor()
        {
            fileSystem = new MockFileSystem(new Dictionary<string, MockFileData>());
            var additionalIngredient = Substitute.For<IAdditionalIngredient>();
            var recipe = new Logic.Recipe.Recipe(fileSystem, "Razor", BaseSite, new[] { additionalIngredient }, false, false);
            recipe.Create();

            additionalIngredient.Received().MixIn(BaseSite);
        }
Example #29
0
            public void CreatesEmptyTemporaryFile()
            {
                var fileSystem = new MockFileSystem();
                var metadata = new NetworkSong();

                var song = MobileSong.Create(metadata, Observable.Never<byte[]>(), fileSystem);

                Assert.Equal(0, fileSystem.FileInfo.FromFileName(song.PlaybackPath).Length);
            }
Example #30
-1
        // The bootstrapper enables you to reconfigure the composition of the framework,
        // by overriding the various methods and properties.
        // For more information https://github.com/NancyFx/Nancy/wiki/Bootstrapper
        protected override void ApplicationStartup(TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines)
        {
            var projRep = new ProjectRepository(null);

            var sampleProj = Samples.SampleProject();
            ProjectIdUsedDuringDevelopment = sampleProj.Id;

            var user = Samples.SampleUser(sampleProj);
            UserIdUsedDuringDevelopment = user.Id;

            projRep.AddProject(sampleProj);
            projRep.AddProject(new Project {Id = Guid.NewGuid(), Name = "Testobjekt"});
            projRep.AddProject(new Project {Id = Guid.NewGuid(), Name = "Skräpobjekt"});

            var fileSystem = new MockFileSystem();
            fileSystem.Directory.CreateDirectory(@"c:\HeatOn\users");
            fileSystem.Directory.CreateDirectory(@"c:\HeatOn\projects");
            var userRep = new UserRepository(fileSystem);
            userRep.SaveUser(user);

            container.Register<IProjectService>(new ProjectService(projRep));
            container.Register<IUserRepository>(userRep);

            //Conventions.ViewLocationConventions.Add((viewName, model, context) =>
            //{
            //    return string.Concat("bin/views/", viewName);
            //});
        }