コード例 #1
0
        public ScriptTagTester()
        {
            new FileSystem().WriteStringToFile("foo.js", "some stuff");

            theFile = new FubuFile("foo.js", ContentFolder.Application);
            theFile.RelativePath = "foo.js";
        }
コード例 #2
0
        public void SetUp()
        {
            new FileSystem().WriteStringToFile("foo.txt", "some text");
            theFile = new FubuFile("foo.txt");

            theResponse = MockRepository.GenerateMock <IHttpResponse>();
        }
コード例 #3
0
        public void SetUp()
        {
            new FileSystem().WriteStringToFile("foo.txt", "some text");
            theFile = new FubuFile("foo.txt", "application");

            theWriter = MockRepository.GenerateMock <IHttpWriter>();
        }
コード例 #4
0
        public void SetUp()
        {
            new FileSystem().WriteStringToFile("foo.txt", "some text");
            theFile = new FubuFile("foo.txt");

            theResponse = MockRepository.GenerateMock <IHttpResponse>();

            WriteFileHeadContinuation.WriteHeaders(theResponse, theFile);
        }
コード例 #5
0
        public void read_lines()
        {
            var file   = new FubuFile(Path.Combine("Runtime", "Files", "Data", "a.txt"), ContentFolder.Application);
            var action = MockRepository.GenerateMock <Action <string> >();

            file.ReadLines(action);

            action.AssertWasCalled(x => x.Invoke("some text from a.txt"));
        }
コード例 #6
0
        private AuthorizationRight forFile(string filename)
        {
            var file         = new FubuFile(filename);
            var owinSettings = new AssetSettings();

            owinSettings.StaticFileRules.Add(new AssetSettings());

            return(owinSettings.DetermineStaticFileRights(file));
        }
コード例 #7
0
        public void SetUp()
        {
            theResponse = MockRepository.GenerateMock <IHttpResponse>();

            new FileSystem().WriteStringToFile("foo.txt", "some text");
            theFile = new FubuFile("foo.txt", "application");

            new WriteFileContinuation(theResponse, theFile, new AssetSettings())
            .Write(theResponse);
        }
コード例 #8
0
        public void is_not_under_exploded_bottle_folder_positive()
        {
            new[] { "some/content", "custom/packages", "files" }.Each(folder =>
            {
                var directory         = "runtime/{0}".ToFormat(folder);
                var fubuFile          = new FubuFile("{0}/b.txt".ToFormat(directory), "app");
                fubuFile.RelativePath = fubuFile.Path.PathRelativeTo(directory);

                FubuApplicationFiles.IsNotUnderExplodedBottleFolder(fubuFile).ShouldBeTrue();
            });
        }
コード例 #9
0
        public void is_not_under_exploded_bottle_folder_negative()
        {
            new[] { FubuMvcPackageFacility.FubuContentFolder, FubuMvcPackageFacility.FubuPackagesFolder }.Each(folder =>
            {
                var directory         = "runtime/{0}/p1".ToFormat(folder);
                var fubuFile          = new FubuFile("{0}/a.txt".ToFormat(directory), "p1");
                fubuFile.RelativePath = fubuFile.Path.PathRelativeTo(directory);

                FubuApplicationFiles.IsNotUnderExplodedBottleFolder(fubuFile).ShouldBeFalse();
            });
        }
コード例 #10
0
ファイル: FubuFileTester.cs プロジェクト: zzekikaya/fubumvc
        public void etag_is_predictable()
        {
            new FileSystem().WriteStringToFile("ghostbusters.txt", "Who you gonna call?");

            var etag1 = new FubuFile("ghostbusters.txt").Etag();
            var etag2 = new FubuFile("ghostbusters.txt").Etag();
            var etag3 = new FubuFile("ghostbusters.txt").Etag();

            etag1.ShouldBe(etag2);
            etag1.ShouldBe(etag3);
        }
コード例 #11
0
ファイル: FubuFileTester.cs プロジェクト: zzekikaya/fubumvc
        public void etag_changes_on_file_changes()
        {
            new FileSystem().WriteStringToFile("ghostbusters.txt", "Who you gonna call?");

            var etag1 = new FubuFile("ghostbusters.txt").Etag();

            new FileSystem().WriteStringToFile("ghostbusters.txt", "He slimed me!");

            var etag2 = new FubuFile("ghostbusters.txt").Etag();

            etag1.ShouldNotBe(etag2);
        }
コード例 #12
0
        public void read_contents_by_stream()
        {
            var wasCalled = false;
            var file      = new FubuFile(Path.Combine("Runtime", "Files", "Data", "a.txt"), ContentFolder.Application);

            file.ReadContents(stream =>
            {
                wasCalled = true;
                stream.ReadAllText().ShouldEqual("some text from a.txt");
            });

            wasCalled.ShouldBeTrue();
        }
コード例 #13
0
ファイル: FubuFileTester.cs プロジェクト: zzekikaya/fubumvc
        public void last_modified()
        {
            var now = DateTime.UtcNow;

            new FileSystem().WriteStringToFile("ghostbusters.txt", "Who you gonna call?");

            var lastModified = new FubuFile("ghostbusters.txt")
                               .LastModified();


            (lastModified.ToFileTimeUtc() - now.ToFileTimeUtc())
            .ShouldBeLessThan(1);
        }
コード例 #14
0
        public void read_contents()
        {
            var file = new FubuFile(Path.Combine("Runtime", "Files", "Data", "a.txt"), ContentFolder.Application);

            file.ReadContents().Trim().ShouldEqual("some text from a.txt");
        }
コード例 #15
0
ファイル: FubuFileTester.cs プロジェクト: zzekikaya/fubumvc
        public void read_contents()
        {
            var file = new FubuFile(Path.Combine("Runtime", "Files", "Data", "a.txt"));

            file.ReadContents().Trim().ShouldBe("some text from a.txt");
        }
コード例 #16
0
        private AuthorizationRight forFile(string filename)
        {
            var file = new FubuFile(filename, null);

            return(new OwinSettings().DetermineStaticFileRights(file));
        }