-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug: interface with get only property generates setter (#40)
* Add failing unit test for interface with get only property. * Fix bug when interface property has get-only, but still generates setter. By checking if interface had getter or setter before adding it to generated decorator abstract class. * Add additional property get/set combinations for unit test.
- Loading branch information
1 parent
8b89c89
commit 356a422
Showing
4 changed files
with
69 additions
and
2 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,13 @@ | ||
using DecoratorGenerator; | ||
|
||
namespace SampleLibrary; | ||
|
||
[Decorate] | ||
public interface ILionProperties | ||
{ | ||
string Name { get; } | ||
|
||
string Color { set; } | ||
|
||
int Age { get; set; } | ||
} |
19 changes: 19 additions & 0 deletions
19
DecoratorGenerator.UnitTests/LionPropertiesDecorator.generated.cs
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,19 @@ | ||
// <auto-generated/> | ||
namespace SampleLibrary; | ||
|
||
public abstract class LionPropertiesDecorator : ILionProperties | ||
{ | ||
private ILionProperties lionProperties; | ||
|
||
protected LionPropertiesDecorator(ILionProperties lionProperties) { | ||
this.lionProperties = lionProperties; | ||
} | ||
|
||
public virtual string Name { get => lionProperties.Name; } | ||
|
||
public virtual string Color { set => lionProperties.Color = value; } | ||
|
||
public virtual int Age { get => lionProperties.Age; set => lionProperties.Age = value; } | ||
|
||
|
||
} |
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
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