-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aa776e4
commit b4baba7
Showing
6 changed files
with
136 additions
and
12 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
59 changes: 59 additions & 0 deletions
59
Reinforced.Typings.Tests/SpecificCases/SpecificTestCases.NestedClassInheritance.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,59 @@ | ||
using Reinforced.Typings.Fluent; | ||
using Xunit; | ||
|
||
namespace TestA | ||
{ | ||
public class TestParentClassA | ||
{ | ||
public string Id { get; set; } | ||
public string Name { get; set; } | ||
} | ||
|
||
} | ||
|
||
namespace TestB | ||
{ | ||
using TestA; | ||
public class SomeOtherClass | ||
{ | ||
public class SomeDerivedClass : TestParentClassA | ||
{ | ||
public int OtherId { get; set; } | ||
} | ||
} | ||
} | ||
|
||
namespace Reinforced.Typings.Tests.SpecificCases | ||
{ | ||
|
||
public partial class SpecificTestCases | ||
{ | ||
[Fact] | ||
public void NestedClassInheritance() | ||
{ | ||
const string result = @" | ||
module TestB { | ||
export interface ISomeDerivedClass extends TestB.ITestParentClassA | ||
{ | ||
OtherId: number; | ||
} | ||
export interface ITestParentClassA | ||
{ | ||
id: string; | ||
text: string; | ||
} | ||
} | ||
"; | ||
AssertConfiguration(s => | ||
{ | ||
s.Global(a => a.DontWriteWarningComment()); | ||
s.ExportAsInterface<TestB.SomeOtherClass.SomeDerivedClass>() | ||
.WithPublicProperties(); | ||
s.ExportAsInterface<TestA.TestParentClassA>() | ||
.WithProperty(c => c.Id, v => v.OverrideName("id")) | ||
.WithProperty(c => c.Name, v => v.OverrideName("text")) | ||
.OverrideNamespace("TestB"); | ||
}, result); | ||
} | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
Reinforced.Typings.Tests/SpecificCases/SpecificTestCases.OverridenNamesNotCamelCased.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,48 @@ | ||
using Reinforced.Typings.Attributes; | ||
using Reinforced.Typings.Fluent; | ||
using Xunit; | ||
|
||
namespace Reinforced.Typings.Tests.SpecificCases | ||
{ | ||
public class TestOverrides | ||
{ | ||
[TsProperty(Name = "ID", ForceNullable = true)] | ||
public virtual int _id { get { return 0; } } | ||
|
||
[TsFunction(Name = "DO_DOMETHING")] | ||
public void DoSomething() { } | ||
|
||
public void AnotherMethod() { } | ||
|
||
public string AnotherProeprty { get; set; } | ||
} | ||
public partial class SpecificTestCases | ||
{ | ||
|
||
|
||
[Fact] | ||
public void OverridenNamesNotCamelCased() | ||
{ | ||
const string result = @" | ||
module Reinforced.Typings.Tests.SpecificCases { | ||
export interface ITestOverrides | ||
{ | ||
ID?: number; | ||
Another_Property: string; | ||
DO_DOMETHING() : void; | ||
Another_Method() : void; | ||
} | ||
}"; | ||
AssertConfiguration(s => | ||
{ | ||
s.Global(a => a.DontWriteWarningComment().CamelCaseForMethods().CamelCaseForProperties()); | ||
s.ExportAsInterface<TestOverrides>() | ||
.WithPublicProperties() | ||
.WithPublicMethods() | ||
.WithMethod(x=>x.AnotherMethod(),x=>x.OverrideName("Another_Method")) | ||
.WithProperty(x=>x.AnotherProeprty,x=>x.OverrideName("Another_Property")) | ||
; | ||
}, result); | ||
} | ||
} | ||
} |
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
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