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); }
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>(); }
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(); }