Пример #1
0
 public void ThrowsExceptionIfFileDoesntExist()
 {
     var directory = new FakeFileSystem();
     var loader = new ImageFileLoader(directory, urlGenerator.Object);
     var exception = Record.Exception(() => loader.GetImageBytes("/cassette.axd/file/test-hash123.png"));
     exception.ShouldBeType<FileNotFoundException>();
 }
Пример #2
0
        public void ThrowsExceptionIfFileDoesntExist()
        {
            var directory = new FakeFileSystem();
            var loader    = new ImageFileLoader(directory, urlGenerator.Object);
            var exception = Record.Exception(() => loader.GetImageBytes("/cassette.axd/file/test-hash123.png"));

            exception.ShouldBeType <FileNotFoundException>();
        }
Пример #3
0
 public void ReadsBytesFromFile()
 {
     var directory = new FakeFileSystem
     {
         { "~/test.png", new byte[] { 1, 2, 3 } }
     };
     var loader = new ImageFileLoader(directory, urlGenerator.Object);
     var output = loader.GetImageBytes("/cassette.axd/file/test-hash123.png");
     output.ShouldEqual(new byte[] { 1, 2, 3 });
 }
Пример #4
0
        public void ReadsBytesFromFile()
        {
            var directory = new FakeFileSystem
            {
                { "~/test.png", new byte[] { 1, 2, 3 } }
            };
            var loader = new ImageFileLoader(directory, urlGenerator.Object);
            var output = loader.GetImageBytes("/cassette.axd/file/test-hash123.png");

            output.ShouldEqual(new byte[] { 1, 2, 3 });
        }