public void SpecifyingMessage_PopulatesSettings()
        {
            var argumentReader = new TestArgumentReader(@"/M:Message");
              var settings = argumentReader.Read();

              Assert.AreEqual("Message", settings.Message);
        }
        public void SpecifyingOnlyMessage_PopulatesDefaultValues()
        {
            var argumentReader = new TestArgumentReader(@"/M:Message");
              var settings = argumentReader.Read();

              Assert.AreEqual(true, settings.LightsEnabled);
              Assert.AreEqual(false, settings.RumblesEnabled);
              Assert.AreEqual(DefaultLights.White, settings.Colour);
              Assert.AreEqual(200, settings.UnitLength);
              Assert.AreEqual(false, settings.RepeatMessage);
        }
        public void ArgumentString_CorrectlyBrokenIntoSeparateArguments()
        {
            const string argumentString = @"/D /R /C:0,0,1 /U:250 /M:Message";
              var argumentReader = new TestArgumentReader(argumentString);

              var switches = argumentReader.Switches;

              Assert.AreEqual(4, switches.Count());
              Assert.AreEqual(@"/D", switches[0]);
              Assert.AreEqual(@"/R", switches[1]);
              Assert.AreEqual(@"/C:0,0,1", switches[2]);
              Assert.AreEqual(@"/U:250", switches[3]);
              Assert.AreEqual(@"Message", argumentReader.Message);
        }
 public void SpecifyingOnlyMessage_DoesNotThrow()
 {
     var argumentReader = new TestArgumentReader(@"/M:Message");
       Assert.DoesNotThrow(() => argumentReader.Read());
 }
 public void SpecifyingNoMessage_ThrowsException()
 {
     var argumentReader = new TestArgumentReader(@"/D /R");
       Assert.Throws<UsageException>(() => argumentReader.Read());
 }
 public void SpecifyingMessage_WithInvalidCharacters_Throws(string arg)
 {
     var argumentReader = new TestArgumentReader(arg);
       Assert.Throws<UsageException>(() => argumentReader.Read());
 }
 public void DisablingLightsAndRumbles_ThrowsException()
 {
     var argumentReader = new TestArgumentReader(@"/L /M:A");
       Assert.Throws<UsageException>(() => argumentReader.Read());
 }
        public void ValidArguments_ReturnsSettings()
        {
            var argumentReader = new TestArgumentReader(@"/M:An example of valid arguments");
              var settings = argumentReader.Read();

              Assert.AreEqual(typeof(Settings), settings.GetType());
        }
 public void Specifying_C_WithIncorrectNumberOfValues_Throws(string arg)
 {
     var argumentReader = new TestArgumentReader(arg);
       Assert.Throws<UsageException>(() => argumentReader.Read());
 }
        public void Specifying_U_SetsUnitLength(string arg)
        {
            var argumentReader = new TestArgumentReader(arg);
              var settings = argumentReader.Read();

              Assert.AreEqual(200, settings.UnitLength);
        }
        public void Specifying_R_EnablesRumbles(string arg)
        {
            var argumentReader = new TestArgumentReader(arg);
              var settings = argumentReader.Read();

              Assert.AreEqual(true, settings.RumblesEnabled);
        }
        public void Specifying_L_DisablesLights(string arg)
        {
            var argumentReader = new TestArgumentReader(arg);
              var settings = argumentReader.Read();

              Assert.AreEqual(false, settings.LightsEnabled);
        }
        public void Specifying_D_SetsRepeatable(string arg)
        {
            var argumentReader = new TestArgumentReader(arg);
              var settings = argumentReader.Read();

              Assert.AreEqual(true, settings.RepeatMessage);
        }
 public void Specifying_C_WithValuesOutOfRange_Throws(string arg)
 {
     var argumentReader = new TestArgumentReader(arg);
       Assert.Throws<UsageException>(() => argumentReader.Read());
 }
 public void Specifying_U_WithInvalidLength_Throws(string arg)
 {
     var argumentReader = new TestArgumentReader(arg);
       Assert.Throws<UsageException>(() => argumentReader.Read());
 }
        public void Specifying_C_SetsColour(string arg)
        {
            var argumentReader = new TestArgumentReader(arg);
              var settings = argumentReader.Read();

              Assert.AreEqual(0, settings.Colour.Red);
              Assert.AreEqual(0.25f, settings.Colour.Green);
              Assert.AreEqual(1f, settings.Colour.Blue);
        }
 public void Specifying_C_WithAllValuesZero_Throws()
 {
     var argumentReader = new TestArgumentReader(@"/C:-0,0,0 /m:A");
       Assert.Throws<UsageException>(() => argumentReader.Read());
 }