Ejemplo n.º 1
0
        public void FileInNetwork(string url, string data)
        {
            DirectoryInfo sourceDir    = new DirectoryInfo("../../../../TestFiles/");
            string        expectedPath = Path.Combine(sourceDir.FullName, data);

            byte[] expected = File.ReadAllBytes(expectedPath);

            ImageGetter imageGetter = new ImageGetter();
            bool        result      = imageGetter.Load(url);

            byte[] actual = imageGetter.ImageData;

            Assert.True(result);
            Assert.Equal(expected, actual);
        }
Ejemplo n.º 2
0
        public void NetFileNotFound(string name)
        {
            DirectoryInfo sourceDir    = new DirectoryInfo("../../../../TestFiles/");
            string        expectedPath = Path.Combine(sourceDir.FullName, name);

            byte[] expected = File.ReadAllBytes(expectedPath);

            string      pathNotExist = "http://Idontcarewhatthiswebsiteis/but/it/should/not/exist!.jpg";
            ImageGetter imageGetter  = new ImageGetter();
            bool        result       = imageGetter.Load(pathNotExist);

            byte[] actual = imageGetter.ImageData;

            Assert.False(result);
            Assert.Equal(expected, actual);
        }
Ejemplo n.º 3
0
        public void DiskFileNotFound(string name)
        {
            output.WriteLine(Directory.GetCurrentDirectory());
            DirectoryInfo sourceDir    = new DirectoryInfo("../../../../TestFiles/");
            string        expectedPath = Path.Combine(sourceDir.FullName, name);

            output.WriteLine(expectedPath);
            byte[] expected = File.ReadAllBytes(expectedPath);

            string      pathNotExist = "/this/path/should/not/be/found/unless/!@#$%^&*()";
            ImageGetter imageGetter  = new ImageGetter();
            bool        result       = imageGetter.Load(pathNotExist);

            output.WriteLine(pathNotExist);
            byte[] actual = imageGetter.ImageData;

            Assert.False(result);
            Assert.Equal(expected, actual);
        }