Ejemplo n.º 1
0
            public void Given_ValidParameters_ExpectValidObject()
            {
                AgoraLog agoraLog = MinhaCdnToAgoraLogConverter.ConvertLog(this.validUrl, this.outputFile);

                agoraLog.Should().NotBeNull();
                agoraLog.Lines.Should().NotBeNull();
                agoraLog.Lines.Count().Should().BeGreaterThan(0);
                agoraLog.ToString().Should().NotBeNull();
                Directory.Exists(Path.GetDirectoryName(this.outputFile)).Should().Be(true);
            }
Ejemplo n.º 2
0
            public void Given_InvalidParameters_ExpectException()
            {
                Action convertLogMethod = () => MinhaCdnToAgoraLogConverter.ConvertLog(string.Empty, string.Empty);

                convertLogMethod.Should().Throw <ArgumentNullException>();

                convertLogMethod = () => MinhaCdnToAgoraLogConverter.ConvertLog(this.randomGenerator.NextString(20, 20), string.Empty);
                convertLogMethod.Should().Throw <UriFormatException>();

                convertLogMethod = () => MinhaCdnToAgoraLogConverter.ConvertLog(this.validUrl, string.Empty);
                convertLogMethod.Should().Throw <ArgumentNullException>();

                convertLogMethod = () => MinhaCdnToAgoraLogConverter.ConvertLog(this.inexistentFileUrl, this.outputFile);
                convertLogMethod.Should().Throw <Exception>();

                convertLogMethod = () => MinhaCdnToAgoraLogConverter.ConvertLog(this.invalidFileUrl, this.outputFile);
                convertLogMethod.Should().Throw <ArgumentException>();
            }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            Console.WriteLine("...::: Agile Content Challenge :::...\r\n");
            Console.WriteLine("* 2 - New CDN iTaas:\r\n");

            if ((args.Count() == 0) || (string.IsNullOrWhiteSpace(args[0])) || (string.IsNullOrWhiteSpace(args[1])) || (!Uri.IsWellFormedUriString(args[0], UriKind.Absolute)))
            {
                Console.WriteLine(">> Usage: convert url outputFile\r\n");
            }
            else
            {
                Console.WriteLine("Downloading and converting log file:\r\n+ {0} +\r\nPlease wait...\r\n", args[0]);
                Console.WriteLine(MinhaCdnToAgoraLogConverter.ConvertLog(args[0], args[1]).ToString());
                Console.WriteLine("+ Log saved: {0}. +\r\n", args[1]);
            }

            Console.WriteLine("Pressione qualquer tecla para sair...");
            Console.ReadKey();
        }