-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Behavior was already correct most likely fixed by the refactoring that introduced PropertyGenerator type
- Loading branch information
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using NUnit.Framework; | ||
|
||
namespace Cecilifier.Core.Tests.Tests.Unit; | ||
|
||
[TestFixture] | ||
public class PropertySpecificTests : CecilifierUnitTestBase | ||
{ | ||
[Test] | ||
public void AccessorAccessibility_IsRespected() | ||
{ | ||
var code = """ | ||
class Foo | ||
{ | ||
public int Value | ||
{ | ||
private get => 1; | ||
set { } | ||
} | ||
} | ||
"""; | ||
|
||
var result = RunCecilifier(code); | ||
var cecilifiedCode = result.GeneratedCode.ReadToEnd(); | ||
|
||
Assert.That(cecilifiedCode, Does.Match(""" | ||
//Getter | ||
\s+var m_get_\d+ = new MethodDefinition\("get_Value", MethodAttributes.Private.+, .+TypeSystem.Int32\); | ||
""")); | ||
|
||
Assert.That(cecilifiedCode, Does.Match(""" | ||
// Setter | ||
\s+var l_set_\d+ = new MethodDefinition\("set_Value", MethodAttributes.Public.+, .+TypeSystem.Void\); | ||
""")); | ||
} | ||
} |