Example #1
0
        public void DeveRetornarNuloCasoUmaExcecaoOcorra()
        {
            var mock            = _autoMocker.GetMock <FakeMockFileSystem>();
            var novoImageReader = new ImagesReader(mock.Object);

            mock.Setup(x => x.Directory)
            .Throws(new Exception("Exceção aleatória"));

            var imagens = novoImageReader.GetListOfImages(TestDirectoryPath);

            imagens.Should().BeNull();
        }
Example #2
0
        public void DeveRetornarListaVaziaCasoNaoEncontreImagensNoDiretorioInformado()
        {
            _mockFileSystem = new MockFileSystem(new Dictionary <string, MockFileData>
            {
                { $"{TestDirectoryPath}{IgnoredTextFileName}", new MockFileData("Testing is meh.") },
            });

            var newImagesReader = new ImagesReader(_mockFileSystem);
            var imagens         = newImagesReader.GetListOfImages(TestDirectoryPath);

            imagens.Should().BeEmpty();
        }
Example #3
0
        public void DeveRetornarImagensApenasDoDiretorioDeBuscaAtual()
        {
            _mockFileSystem = new MockFileSystem(new Dictionary <string, MockFileData>
            {
                { $@"{TestDirectoryPath}{Image1Name}", new MockFileData(new byte[] { 0x12, 0x34, 0x56, 0xd2 }) },
                { $@"{TestDirectoryPath}\subdiretorio\{Image2Name}", new MockFileData(new byte[] { 0x12, 0x34, 0x56, 0xd2 }) }
            });

            var newImagesReader = new ImagesReader(_mockFileSystem);
            var imagens         = newImagesReader.GetListOfImages(TestDirectoryPath);

            imagens.Count.Should().Be(1);
            imagens.Should().NotContain(x => x.Contains(Image2Name));
        }
Example #4
0
        public void Inicializar()
        {
            _autoMocker = new AutoMocker();

            _mockFileSystem = new MockFileSystem(new Dictionary <string, MockFileData>
            {
                { $"{TestDirectoryPath}{IgnoredTextFileName}", new MockFileData("Testing is meh.") },
                { $"{TestDirectoryPath}{Image1Name}", new MockFileData(new byte[] { 0x12, 0x34, 0x56, 0xd2 }) },
                { $"{TestDirectoryPath}{Image2Name}", new MockFileData(new byte[] { 0x12, 0x34, 0x56, 0xd2 }) },
                { $"{TestDirectoryPath}{IgnoredImageName}", new MockFileData(new byte[] { 0x12, 0x34, 0x56, 0xd2 }) }
            });

            _imagesReader = new ImagesReader(_mockFileSystem);
        }