예제 #1
0
        static void Main(string[] args)
        {
            DirectoryService service = new DirectoryService("C:/");

            Console.WriteLine("Criando Diretório...");
            var code = service.CreateNewDirectory("to");

            if (code == DirectoryStatus.Failed)
            {
                Console.WriteLine("Falha ao criar o diretório.");
                return;
            }

            Console.WriteLine("Copiando Imagens...");
            code = service.CopyImages("from", "to");
            if (code == DirectoryStatus.Inexistent)
            {
                Console.WriteLine("Verifique se os diretórios informados existem.");
                return;
            }
            else if (code == DirectoryStatus.Failed)
            {
                Console.WriteLine("Falha ao copiar as imagens.");
                return;
            }

            Console.WriteLine("Arquivos copiados com sucesso.");
        }
예제 #2
0
        public void CreateNewDirectory_GivenInvalidPath_ReturnStatusFailed()
        {
            //arrange
            DirectoryService service       = new DirectoryService("///");
            string           directoryName = "firstDirectory";

            //act
            DirectoryStatus d = service.CreateNewDirectory(directoryName);

            //assert
            d.Should().Be(DirectoryStatus.Failed);
        }
예제 #3
0
        public void CreateNewDirectory_GivenInexistentDirectory_ReturnStatusSuccess()
        {
            //arrange
            DirectoryService service       = new DirectoryService("");
            string           directoryName = "firstDirectory";

            //act
            DirectoryStatus d = service.CreateNewDirectory(directoryName);

            //assert
            d.Should().Be(DirectoryStatus.Success);

            Directory.Delete(directoryName);
        }