|
8 | 8 | using System.Collections.Immutable;
|
9 | 9 | using System.Globalization;
|
10 | 10 | using Microsoft.AspNetCore.Razor.Language.Components;
|
| 11 | +using Roslyn.Test.Utilities; |
11 | 12 | using Xunit;
|
12 | 13 | using static Microsoft.AspNetCore.Razor.Language.CommonMetadata;
|
13 | 14 |
|
@@ -555,6 +556,83 @@ public void CreatesMarkupCodeSpansForNonStringTagHelperAttributes12()
|
555 | 556 | EvaluateData(CodeTagHelperAttributes_Descriptors, "<person age=\"@{flag == 0 ? 11 : 12}\" />");
|
556 | 557 | }
|
557 | 558 |
|
| 559 | + [Fact, WorkItem("https://github.com/dotnet/razor/issues/10186")] |
| 560 | + public void CreatesMarkupCodeSpansForNonStringTagHelperAttributes13() |
| 561 | + { |
| 562 | + EvaluateData(CodeTagHelperAttributes_Descriptors, """ |
| 563 | + @{ |
| 564 | + var count = "1"; |
| 565 | + } |
| 566 | + <person age="Convert.ToInt32(@count)" /> |
| 567 | + """); |
| 568 | + } |
| 569 | + |
| 570 | + [Fact, WorkItem("https://github.com/dotnet/razor/issues/10186")] |
| 571 | + public void CreatesMarkupCodeSpansForNonStringTagHelperAttributes14() |
| 572 | + { |
| 573 | + EvaluateData(CodeTagHelperAttributes_Descriptors, """ |
| 574 | + @{ |
| 575 | + var @string = "1"; |
| 576 | + } |
| 577 | + <person age="Convert.ToInt32(@string)" /> |
| 578 | + """); |
| 579 | + } |
| 580 | + |
| 581 | + [Fact, WorkItem("https://github.com/dotnet/razor/issues/10186")] |
| 582 | + public void CreatesMarkupCodeSpansForNonStringTagHelperAttributes15() |
| 583 | + { |
| 584 | + EvaluateData(CodeTagHelperAttributes_Descriptors, """ |
| 585 | + @{ |
| 586 | + var count = "1"; |
| 587 | + } |
| 588 | + <person age=Convert.ToInt32(@count) /> |
| 589 | + """); |
| 590 | + } |
| 591 | + |
| 592 | + [Fact, WorkItem("https://github.com/dotnet/razor/issues/10186")] |
| 593 | + public void CreatesMarkupCodeSpansForNonStringTagHelperAttributes16() |
| 594 | + { |
| 595 | + EvaluateData(CodeTagHelperAttributes_Descriptors, """ |
| 596 | + @{ |
| 597 | + var count = "1"; |
| 598 | + } |
| 599 | + <person age='Convert.ToInt32(@count + "2")' /> |
| 600 | + """); |
| 601 | + } |
| 602 | + |
| 603 | + [Fact, WorkItem("https://github.com/dotnet/razor/issues/10186")] |
| 604 | + public void CreatesMarkupCodeSpansForNonStringTagHelperAttributes17() |
| 605 | + { |
| 606 | + EvaluateData(CodeTagHelperAttributes_Descriptors, """ |
| 607 | + @{ |
| 608 | + var count = 1; |
| 609 | + } |
| 610 | + <person age='@@count' /> |
| 611 | + """); |
| 612 | + } |
| 613 | + |
| 614 | + [Fact, WorkItem("https://github.com/dotnet/razor/issues/10186")] |
| 615 | + public void CreatesMarkupCodeSpansForNonStringTagHelperAttributes18() |
| 616 | + { |
| 617 | + EvaluateData(CodeTagHelperAttributes_Descriptors, """ |
| 618 | + @{ |
| 619 | + var count = 1; |
| 620 | + } |
| 621 | + <person age="@@count" /> |
| 622 | + """); |
| 623 | + } |
| 624 | + |
| 625 | + [Fact, WorkItem("https://github.com/dotnet/razor/issues/10186")] |
| 626 | + public void CreatesMarkupCodeSpansForNonStringTagHelperAttributes19() |
| 627 | + { |
| 628 | + EvaluateData(CodeTagHelperAttributes_Descriptors, """ |
| 629 | + @{ |
| 630 | + var count = 1; |
| 631 | + } |
| 632 | + <person age=@@count /> |
| 633 | + """); |
| 634 | + } |
| 635 | + |
558 | 636 | [Fact]
|
559 | 637 | public void TagHelperParseTreeRewriter_CreatesErrorForIncompleteTagHelper1()
|
560 | 638 | {
|
|
0 commit comments