public GenericFileResponseFixture(ITestOutputHelper output)
        {
            var environment = new DefaultNancyEnvironment();
            environment.StaticContent(safepaths: this.GetLocation());

            this.context = new NancyContext { Environment = environment };

            this.filePath = this.GetFilePath();
        }
Exemplo n.º 2
0
        public GenericFileResponseFixture(ITestOutputHelper output)
        {
            var environment = new DefaultNancyEnvironment();

            environment.StaticContent(safepaths: this.GetLocation());

            this.context = new NancyContext {
                Environment = environment
            };

            this.filePath = this.GetFilePath();
        }
Exemplo n.º 3
0
        public GenericFileResponseFixture()
        {
            var assemblyPath =
                Path.GetDirectoryName(this.GetType().Assembly.Location);
            
            var environment = new DefaultNancyEnvironment();
            environment.StaticContent(safepaths:assemblyPath);

            this.context = new NancyContext { Environment = environment };

            this.imagePath =
                Path.GetFileName(this.GetType().Assembly.Location);
        }
Exemplo n.º 4
0
        public void Should_use_filename_and_content_type_for_attachments_from_file_response_if_not_overridden()
        {
            // Given
            var environment = new DefaultNancyEnvironment();
            environment.StaticContent(safepaths:this.GetLocation());

            var filename = this.GetFilePath();
            var response = new GenericFileResponse(filename, "foo/bar", new NancyContext() {Environment = environment});

            // When
            var result = response.AsAttachment();

            // Then
            result.Headers["Content-Disposition"].ShouldContain(Path.GetFileName(filename));
            result.ContentType.ShouldEqual("foo/bar");
        }
        public GenericFileResponseFixture()
        {
            var assemblyPath =
                Path.GetDirectoryName(this.GetType().Assembly.Location);

            var environment = new DefaultNancyEnvironment();

            environment.StaticContent(safepaths: assemblyPath);

            this.context = new NancyContext {
                Environment = environment
            };

            this.imagePath =
                Path.GetFileName(this.GetType().Assembly.Location);
        }
Exemplo n.º 6
0
        public void Should_use_filename_and_content_type_for_attachments_from_file_response_if_not_overridden()
        {
            // Given
            var assemblyPath =
                Path.GetDirectoryName(this.GetType().Assembly.Location);

            var environment = new DefaultNancyEnvironment();
            environment.StaticContent(safepaths:assemblyPath);

            var filename = Path.GetFileName(this.GetType().Assembly.Location);
            var response = new GenericFileResponse(filename, "image/png", new NancyContext() {Environment = environment});

            // When
            var result = response.AsAttachment();
            
            // Then
            result.Headers["Content-Disposition"].ShouldContain(filename);
            result.ContentType.ShouldEqual("image/png");
        }
Exemplo n.º 7
0
        public void Should_use_filename_and_content_type_for_attachments_from_file_response_if_not_overridden()
        {
            // Given
            var environment = new DefaultNancyEnvironment();

            environment.StaticContent(safepaths: this.GetLocation());

            var filename = this.GetFilePath();
            var response = new GenericFileResponse(filename, "foo/bar", new NancyContext()
            {
                Environment = environment
            });

            // When
            var result = response.AsAttachment();

            // Then
            result.Headers["Content-Disposition"].ShouldContain(Path.GetFileName(filename));
            result.ContentType.ShouldEqual("foo/bar");
        }
Exemplo n.º 8
0
        public void Should_use_filename_and_content_type_for_attachments_from_file_response_if_not_overridden()
        {
            // Given
            var assemblyPath =
                Path.GetDirectoryName(this.GetType().Assembly.Location);

            var environment = new DefaultNancyEnvironment();

            environment.StaticContent(safepaths: assemblyPath);

            var filename = Path.GetFileName(this.GetType().Assembly.Location);
            var response = new GenericFileResponse(filename, "image/png", new NancyContext()
            {
                Environment = environment
            });

            // When
            var result = response.AsAttachment();

            // Then
            result.Headers["Content-Disposition"].ShouldContain(filename);
            result.ContentType.ShouldEqual("image/png");
        }