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); }
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); }
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(); }); }
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); }
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); }
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(); }
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)); }
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; })); }
// 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; }); }
// 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; })); }
private AuthorizationRight forFile(string filename) { var file = new FubuFile(filename, null); var owinSettings = new AssetSettings(); owinSettings.StaticFileRules.Add(new AssetSettings()); return owinSettings.DetermineStaticFileRights(file); }
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")); }
public void read_contents() { var file = new FubuFile(Path.Combine("Runtime", "Files", "Data", "a.txt")); file.ReadContents().Trim().ShouldBe("some text from a.txt"); }
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"); }
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>(); }
protected bool Equals(FubuFile other) { return(string.Equals(RelativePath, other.RelativePath)); }
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); }
protected bool Equals(FubuFile other) { return string.Equals(RelativePath, other.RelativePath); }