Skip to content

Commit

Permalink
Recharacterize the buggy formatting of linq.
Browse files Browse the repository at this point in the history
This is fixed again in a later version of roslyn but we can't update due to another bug
dotnet/roslyn#63921
  • Loading branch information
GrahamTheCoder committed Apr 21, 2024
1 parent 7772c1c commit 783ecc0
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions Tests/CSharp/ExpressionTests/XmlExpressionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,22 +116,22 @@ private void TestMethod()
{
var catalog = new XDocument(
new XElement(""Catalog"",
new XElement(""Book"", new XAttribute(""id"", ""bk101""),
new XElement(""Author"", ""Garghentini, Davide""),
new XElement(""Title"", ""XML Developer's Guide""),
new XElement(""Price"", ""44.95""),
new XElement(""Description"", @""
new XElement(""Book"", new XAttribute(""id"", ""bk101""),
new XElement(""Author"", ""Garghentini, Davide""),
new XElement(""Title"", ""XML Developer's Guide""),
new XElement(""Price"", ""44.95""),
new XElement(""Description"", @""
An in-depth look at creating applications
with "", new XElement(""technology"", ""XML""), @"". For
"", new XElement(""audience"", ""beginners""), @"" or
"", new XElement(""audience"", ""advanced""), @"" developers.
"")
),
new XElement(""Book"", new XAttribute(""id"", ""bk331""),
new XElement(""Author"", ""Spencer, Phil""),
new XElement(""Title"", ""Developing Applications with Visual Basic .NET""),
new XElement(""Price"", ""45.95""),
new XElement(""Description"", @""
),
new XElement(""Book"", new XAttribute(""id"", ""bk331""),
new XElement(""Author"", ""Spencer, Phil""),
new XElement(""Title"", ""Developing Applications with Visual Basic .NET""),
new XElement(""Price"", ""45.95""),
new XElement(""Description"", @""
Get the expert insights, practical code samples,
and best practices you need
to advance your expertise with "", new XElement(""technology"", @""Visual
Expand All @@ -140,21 +140,23 @@ and best practices you need
based on professional,
pragmatic guidance by today's top "", new XElement(""audience"", ""developers""), @"".
"")
)
)
)
);
var htmlOutput = new XElement(""html"",
new XElement(""body"", from book in catalog.Elements(""Catalog"").Elements(""Book"")
select new XElement(""div"",
new XElement(""h1"", book.Elements(""Title"").Value),
new XElement(""h3"", ""By "" + book.Elements(""Author"").Value),
new XElement(""h3"", ""Price = "" + book.Elements(""Price"").Value),
new XElement(""h1"", book.Elements(""Title"").Value),
new XElement(""h3"", ""By "" + book.Elements(""Author"").Value),
new XElement(""h3"", ""Price = "" + book.Elements(""Price"").Value),
new XElement(""h2"", ""Description""), TransformDescription((string)book.Elements(""Description"").ElementAtOrDefault(0)), new XElement(""hr"")
)
)
);
)
)
);
}
public string TransformDescription(string s)
Expand Down

0 comments on commit 783ecc0

Please sign in to comment.