public void Encodes_Digits(string message, string expected) { MorseEncoder encode = new MorseEncoder(); string actual = encode.Encode(message); Assert.That(actual, Is.EqualTo(expected)); }
public void With_Empty_Throws_ArgumentOutOfRangeException() { MorseEncoder encode = new MorseEncoder(); //Assume.That(Environment.ProcessorCount <= 2); Warn.If(Environment.ProcessorCount <= 2); Warn.Unless(Environment.ProcessorCount <= 2, "No cumple con la condiciĆ³n"); Assert.That(() => encode.Encode(string.Empty), Throws.InstanceOf <ArgumentOutOfRangeException>()); }
public void With_Null_Throws_ArgumentNullException() { const string message = null; int numberProcesador = Environment.ProcessorCount; //Assume.That(Environment.ProcessorCount >= 2); Warn.If(Environment.ProcessorCount >= 2); Warn.Unless(Environment.ProcessorCount >= 2, "No cumple con la condiciĆ³n"); MorseEncoder encode = new MorseEncoder(); Assert.That(() => encode.Encode(message), Throws.ArgumentNullException); }
public void Encodes_phrases_words() { string path = @"c:\Users\Wepsys\Documents\prueba.txt"; string[] lines = File.ReadAllLines(path); MorseEncoder encoder = new MorseEncoder(); var firstValue = ""; var secondValue = ""; //var array1 = lines[0].Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries)[0]; //var array2 = lines[1].Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries)[1]; foreach (var line in lines) { firstValue = line.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries)[0]; secondValue = line.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries)[1]; } string message2 = encoder.Encode(firstValue); Assert.That(message2, Is.EqualTo(secondValue)); }
public void EncoderTest() { Assert.AreEqual(".... -.. .-.. .-.. --- .-- --- .-. .-.. -.-.", MorseEncoder.Encoder("Hello world")); }
public string Encodes_Digits2(string message) { MorseEncoder encode = new MorseEncoder(); return(encode.Encode(message)); }