예제 #1
0
    public void equals_must_be_before_first_colon()
    {
        var line = "G195:malformed name=value";
        var sut  = new SettingsParser();

        sut.ExtractLine(line);
    }
예제 #2
0
    public void Setting_name_is_required()
    {
        var line = "G195 malformed";
        var sut  = new SettingsParser();

        sut.ExtractLine(line);
    }
 public void Should_be_able_to_extract_name_from_a_line()
 {
     var line = "G195=Out:LED0799,LED0814,Flags:L-N Desc:\"EAF-QCH-B1-01\" Invert:00 STO:35 SP:0 FStart: FStop: ";
     var sut = new SettingsParser();
     var actual = sut.ExtractLine(line);
     Assert.AreEqual("G195", actual.Name);
 }
예제 #4
0
    public void allow_empty_values_even_if_its_not_the_last()
    {
        var line   = "G195=In: Out:Heavy";
        var sut    = new SettingsParser();
        var actual = sut.ExtractLine(line);

        Assert.AreEqual("", actual.Parameters["In"]);
    }
예제 #5
0
    public void allow_empty_values()
    {
        var line   = "G195=In:";
        var sut    = new SettingsParser();
        var actual = sut.ExtractLine(line);

        Assert.AreEqual("", actual.Parameters["In"]);
    }
예제 #6
0
    public void second_parameter_value_should_also_be_able_To_be_quoted()
    {
        var line   = "G195=In:Stream Out:\"LED0799 Invert:00\"";
        var sut    = new SettingsParser();
        var actual = sut.ExtractLine(line);

        Assert.AreEqual("LED0799 Invert:00", actual.Parameters["Out"]);
    }
예제 #7
0
    public void should_be_able_to_include_spaces_in_value_names_if_they_are_wrapped_by_quotes()
    {
        var line   = "G195=Out:\"LED0799 Invert:00\"";
        var sut    = new SettingsParser();
        var actual = sut.ExtractLine(line);

        Assert.AreEqual("LED0799 Invert:00", actual.Parameters["Out"]);
    }
예제 #8
0
    public void should_be_able_to_parse_multiple_properties()
    {
        var line   = "G195=Out:LED0799 Invert:00";
        var sut    = new SettingsParser();
        var actual = sut.ExtractLine(line);

        Assert.AreEqual("00", actual.Parameters["Invert"]);
    }
예제 #9
0
    public void Should_be_able_to_extract_a_single_parameter()
    {
        var line   = "G195=Out:LED0799";
        var sut    = new SettingsParser();
        var actual = sut.ExtractLine(line);

        Assert.AreEqual("LED0799", actual.Parameters["Out"]);
    }