コード例 #1
0
        public void ShouldNotLoadAssetThatDoesntExist()
        {
            var ctlr   = new AssetsController();
            var ctx    = new TestHttpContext();
            var rezult = ctlr.At(ctx, new List <PositionedResult>(), @"c:\Temp\", Guid.NewGuid() + "\\index.html");

            ctx.Response.StatusCode.Should().Be(404);
        }
コード例 #2
0
        public void ShouldNotLoadAssetOutOfSandBox()
        {
            var ctlr   = new AssetsController();
            var ctx    = new TestHttpContext();
            var rezult = ctlr.At(ctx, new List <PositionedResult>(), @"c:\Something\", @"path\..\..\");

            ctx.Response.StatusCode.Should().Be(404);
        }
コード例 #3
0
        public void ShouldLoadAssetThatExists()
        {
            var ctlr = new AssetsController();
            var ctx  = new TestHttpContext();
            var path = Path.GetTempFileName();

            File.WriteAllText(path, "Scott Youngblut");
            var rezult = ctlr.At(ctx, new List <PositionedResult>(), Path.GetDirectoryName(path), Path.GetFileName(path));

            ctx.Response.StatusCode.Should().Be(200);
            rezult.Content.BodyAsString.Should().Be("Scott Youngblut");
        }