Ejemplo n.º 1
0
        public ScriptTagTester()
        {
            new FileSystem().WriteStringToFile("foo.js", "some stuff");

            theFile = new FubuFile("foo.js");
            theFile.RelativePath = "foo.js";
        }
        public void SetUp()
        {
            new FileSystem().WriteStringToFile("foo.txt", "some text");
            theFile = new FubuFile("foo.txt");

            theResponse = MockRepository.GenerateMock<IHttpResponse>();

            WriteFileHeadContinuation.WriteHeaders(theResponse, theFile);
        }
Ejemplo n.º 3
0
        public IEnumerable<IFubuFile> FindFiles(FileSet fileSet)
        {
            return _fileSystem.FindFiles(Path, fileSet).Select(file =>
            {
                var fubuFile = new FubuFile(file, Provenance);
                fubuFile.RelativePath = file.PathRelativeTo(Path).Replace("\\", "/");

                return fubuFile;
            });
        }
        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);
        }
Ejemplo n.º 5
0
        public void etag_is_predictable()
        {
            new FileSystem().WriteStringToFile("ghostbusters.txt", "Who you gonna call?");

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

            etag1.ShouldEqual(etag2);
            etag1.ShouldEqual(etag3);
        }
        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();
            });
        }
        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();
            });
        }
Ejemplo n.º 8
0
        public void etag_changes_on_file_changes()
        {
            new FileSystem().WriteStringToFile("ghostbusters.txt", "Who you gonna call?");

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

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

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

            etag1.ShouldNotEqual(etag2);
        }
Ejemplo n.º 9
0
        public void last_modified()
        {
            var now = DateTime.UtcNow;

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

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

            (lastModified.ToFileTimeUtc() - now.ToFileTimeUtc())
                .ShouldBeLessThan(1);
        }
Ejemplo n.º 10
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();
        }
Ejemplo n.º 11
0
 public bool Equals(FubuFile other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(Equals(other.Path, Path) && Equals(other.Provenance, Provenance));
 }
Ejemplo n.º 12
0
        public IEnumerable <IFubuFile> FindFiles(FileSet fileSet)
        {
            return(_fileSystem.FindFiles(Path, fileSet).Select(file =>
            {
                var fubuFile = new FubuFile(file, Provenance)
                {
                    ProvenancePath = Path,
                    RelativePath = file.PathRelativeTo(Path).Replace("\\", "/")
                };

                return fubuFile;
            }));
        }
Ejemplo n.º 13
0
        // I'm okay with this finding nulls

        public IEnumerable<IFubuFile> FindFiles(FileSet fileSet)
        {
            return _fileSystem.FindFiles(_root, fileSet).Select(file =>
            {
                var fubuFile = new FubuFile(file)
                {
                    RelativePath = file.PathRelativeTo(_root).Replace("\\", "/")
                };

                if (fubuFile.RelativePath.IsEmpty())
                {
                    throw new ArgumentException("Not able to determine a relative path for " + file);
                }

                return fubuFile;
            });
        }
Ejemplo n.º 14
0
        // I'm okay with this finding nulls

        public IEnumerable <IFubuFile> FindFiles(FileSet fileSet)
        {
            return(_fileSystem.FindFiles(_root, fileSet).Select(file =>
            {
                var fubuFile = new FubuFile(file)
                {
                    RelativePath = file.PathRelativeTo(_root).Replace("\\", "/")
                };

                if (fubuFile.RelativePath.IsEmpty())
                {
                    throw new ArgumentException("Not able to determine a relative path for " + file);
                }

                return fubuFile;
            }));
        }
Ejemplo n.º 15
0
        private AuthorizationRight forFile(string filename)
        {
            var file = new FubuFile(filename, null);
            var owinSettings = new AssetSettings();
            owinSettings.StaticFileRules.Add(new AssetSettings());

            return owinSettings.DetermineStaticFileRights(file);
        }
Ejemplo n.º 16
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"));
        }
Ejemplo n.º 17
0
 public void read_contents()
 {
     var file = new FubuFile(Path.Combine("Runtime", "Files", "Data", "a.txt"));
     file.ReadContents().Trim().ShouldBe("some text from a.txt");
 }
Ejemplo n.º 18
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");
 }
Ejemplo n.º 19
0
 private AuthorizationRight forFile(string filename)
 {
     var file = new FubuFile(filename, null);
     return new OwinSettings().DetermineStaticFileRights(file);
 }
        public void SetUp()
        {
            new FileSystem().WriteStringToFile("foo.txt", "some text");
            theFile = new FubuFile("foo.txt");

            theResponse = MockRepository.GenerateMock<IHttpResponse>();
        }
Ejemplo n.º 21
0
 protected bool Equals(FubuFile other)
 {
     return(string.Equals(RelativePath, other.RelativePath));
 }
Ejemplo n.º 22
0
 public bool Equals(FubuFile other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return Equals(other.Path, Path) && Equals(other.Provenance, Provenance);
 }
Ejemplo n.º 23
0
 protected bool Equals(FubuFile other)
 {
     return string.Equals(RelativePath, other.RelativePath);
 }