/
SpecificTestCases.ReferencesPart2.cs
69 lines (66 loc) · 2.54 KB
/
SpecificTestCases.ReferencesPart2.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using System.Collections.Generic;
using System.IO;
using Reinforced.Typings.Fluent;
using Xunit;
namespace Reinforced.Typings.Tests.SpecificCases
{
public partial class SpecificTestCases
{
[Fact]
public void ReferencesPart2()
{
/**
* File1:
* Reference to File3 appears as it is explicitly specified: .AddReference(typeof(SomeFluentReferencedType))
* Reference to jquery appears as it is explicitly specified via attribute
* Imports does not appear as we are not using modules
* Reference to File2 appears as we are exporting method "Indirect" returning SomeIndirectlyReferencedClass
* Refernce to SomeFluentlyReferencedNotExported does not appear as it is not exported entirely
*/
const string file1 = @"
///<reference path=""../../jquery.d.ts""/>
///<reference path=""../Fluently/File3.ts""/>
///<reference path=""../Indirect/File2.ts""/>
module Reinforced.Typings.Tests.SpecificCases {
export class SomeReferencingType
{
public Indirect() : Reinforced.Typings.Tests.SpecificCases.SomeIndirectlyReferencedClass
{
return null;
}
}
}";
const string file2 = @"
module Reinforced.Typings.Tests.SpecificCases {
export class SomeIndirectlyReferencedClass
{
}
}";
const string file3 = @"
module Reinforced.Typings.Tests.SpecificCases {
export class SomeFluentReferencedType
{
}
}";
AssertConfiguration(s =>
{
s.Global(a => a.DontWriteWarningComment());
s.ExportAsClass<SomeReferencingType>()
.AddReference(typeof(SomeFluentReferencedType))
.AddReference(typeof(SomeFluentlyReferencedNotExported))
.AddImport("* as React", "React")
.ExportTo("Exported/File1.ts")
.AddImport("sideeffects", "./sideeffects", true)
.WithPublicMethods() //<--- this line differs from references part 1
;
s.ExportAsClass<SomeIndirectlyReferencedClass>().ExportTo("Indirect/File2.ts");
s.ExportAsClass<SomeFluentReferencedType>().ExportTo("Fluently/File3.ts");
}, new Dictionary<string, string>
{
{ Path.Combine(TargetDir, "Exported", "File1.ts"), file1 },
{ Path.Combine(TargetDir, "Indirect", "File2.ts"), file2 },
{ Path.Combine(TargetDir, "Fluently", "File3.ts"), file3 }
}, compareComments: true);
}
}
}