Esempio n. 1
0
        public void TestToggleDebugCommasWithLeadingBlockComment()
        {
            var input    = @"Line 1,
/* leading comment */ Line 2,
Line 3";
            var expected = @"Line 1
,/* leading comment */ Line 2
,Line 3";
            var actual   = FormatDebugMode.ToggleDebugCommas(input);

            //Assert.AreEqual(expected, actual);
            StringAssertion.ShouldEqualWithDiff(expected.NormalizeNewline(), actual.NormalizeNewline(), DiffStyle.Full);

            actual = FormatDebugMode.ToggleDebugCommas(actual);
            //Assert.AreEqual(expected, actual);
            StringAssertion.ShouldEqualWithDiff(input.NormalizeNewline(), actual.NormalizeNewline(), DiffStyle.Full);
        }
Esempio n. 2
0
        public void TestToggleDebugCommas()
        {
            var input    = @"Date =
VAR FirstYear = -- Customizes the first year to use
    YEAR ( MIN ( Sales[Order Date] ) )
RETURN
ADDCOLUMNS (
    FILTER (
        CALENDARAUTO (),
        YEAR ( [Date] ) >= FirstYear
    ),
    ""Year"", DATE ( YEAR ( [Date] ), 12, 31 ),
    ""Year Month"", EOMONTH( [Date], 0 ),
    ""Month"", FORMAT( [Date], ""mmm"" ),
    ""Month Number"", MONTH( [Date] ),
    ""Day of Week"", FORMAT( [Date], ""ddd"" ),
    ""Day of Week Number"", WEEKDAY( [Date], 1 )
)";
            var expected = @"Date =
VAR FirstYear = -- Customizes the first year to use
    YEAR ( MIN ( Sales[Order Date] ) )
RETURN
ADDCOLUMNS (
    FILTER (
        CALENDARAUTO ()
,        YEAR ( [Date] ) >= FirstYear
    )
,    ""Year"", DATE ( YEAR ( [Date] ), 12, 31 )
,    ""Year Month"", EOMONTH( [Date], 0 )
,    ""Month"", FORMAT( [Date], ""mmm"" )
,    ""Month Number"", MONTH( [Date] )
,    ""Day of Week"", FORMAT( [Date], ""ddd"" )
,    ""Day of Week Number"", WEEKDAY( [Date], 1 )
)";
            var actual   = FormatDebugMode.ToggleDebugCommas(input);

            //Assert.AreEqual(expected, actual);
            StringAssertion.ShouldEqualWithDiff(expected.NormalizeNewline(), actual.NormalizeNewline(), DiffStyle.Full);

            actual = FormatDebugMode.ToggleDebugCommas(actual);
            //Assert.AreEqual(expected, actual);
            StringAssertion.ShouldEqualWithDiff(input.NormalizeNewline(), actual.NormalizeNewline(), DiffStyle.Full);
        }
Esempio n. 3
0
        public void TestToggleDebugCommasWithSimpleIndentedComments()
        {
            var input    = @"Line 1,
  -- comment with leading space
Line 2,
Line 3";
            var expected = @"Line 1
  -- comment with leading space
,Line 2
,Line 3";
            var actual   = FormatDebugMode.ToggleDebugCommas(input);

            //Assert.AreEqual(expected, actual);
            StringAssertion.ShouldEqualWithDiff(expected.NormalizeNewline(), actual.NormalizeNewline(), DiffStyle.Full);

            actual = FormatDebugMode.ToggleDebugCommas(actual);
            //Assert.AreEqual(expected, actual);
            StringAssertion.ShouldEqualWithDiff(input.NormalizeNewline(), actual.NormalizeNewline(), DiffStyle.Full);
        }