diff options
Diffstat (limited to '')
-rw-r--r-- | src/test/WixToolsetTest.Data/TupleDefinitionFixture.cs | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/src/test/WixToolsetTest.Data/TupleDefinitionFixture.cs b/src/test/WixToolsetTest.Data/TupleDefinitionFixture.cs index 9854ba9f..cde4a675 100644 --- a/src/test/WixToolsetTest.Data/TupleDefinitionFixture.cs +++ b/src/test/WixToolsetTest.Data/TupleDefinitionFixture.cs | |||
@@ -3,59 +3,59 @@ | |||
3 | namespace WixToolsetTest.Data | 3 | namespace WixToolsetTest.Data |
4 | { | 4 | { |
5 | using WixToolset.Data; | 5 | using WixToolset.Data; |
6 | using WixToolset.Data.Tuples; | 6 | using WixToolset.Data.Symbols; |
7 | using Xunit; | 7 | using Xunit; |
8 | 8 | ||
9 | public class TupleDefinitionFixture | 9 | public class SymbolDefinitionFixture |
10 | { | 10 | { |
11 | [Fact] | 11 | [Fact] |
12 | public void CanCreateFileTuple() | 12 | public void CanCreateFileSymbol() |
13 | { | 13 | { |
14 | var tuple = TupleDefinitions.File.CreateTuple(); | 14 | var symbol = SymbolDefinitions.File.CreateSymbol(); |
15 | Assert.IsType<FileTuple>(tuple); | 15 | Assert.IsType<FileSymbol>(symbol); |
16 | Assert.Same(TupleDefinitions.File, tuple.Definition); | 16 | Assert.Same(SymbolDefinitions.File, symbol.Definition); |
17 | } | 17 | } |
18 | 18 | ||
19 | [Fact] | 19 | [Fact] |
20 | public void CanCreateFileTupleByName() | 20 | public void CanCreateFileSymbolByName() |
21 | { | 21 | { |
22 | var tuple = TupleDefinitions.ByName("File").CreateTuple(); | 22 | var symbol = SymbolDefinitions.ByName("File").CreateSymbol(); |
23 | Assert.IsType<FileTuple>(tuple); | 23 | Assert.IsType<FileSymbol>(symbol); |
24 | Assert.Same(TupleDefinitions.File, tuple.Definition); | 24 | Assert.Same(SymbolDefinitions.File, symbol.Definition); |
25 | } | 25 | } |
26 | 26 | ||
27 | //[Fact] | 27 | //[Fact] |
28 | //public void CanCreateFileTupleByType() | 28 | //public void CanCreateFileSymbolByType() |
29 | //{ | 29 | //{ |
30 | // var tuple = TupleDefinitions.CreateTuple<FileTuple>(); | 30 | // var symbol = SymbolDefinitions.CreateSymbol<FileSymbol>(); |
31 | // Assert.Same(TupleDefinitions.File, tuple.Definition); | 31 | // Assert.Same(SymbolDefinitions.File, symbol.Definition); |
32 | //} | 32 | //} |
33 | 33 | ||
34 | [Fact] | 34 | [Fact] |
35 | public void CanSetComponentFieldInFileTupleByCasting() | 35 | public void CanSetComponentFieldInFileSymbolByCasting() |
36 | { | 36 | { |
37 | var fileTuple = (FileTuple)TupleDefinitions.File.CreateTuple(); | 37 | var fileSymbol = (FileSymbol)SymbolDefinitions.File.CreateSymbol(); |
38 | fileTuple.ComponentRef = "Foo"; | 38 | fileSymbol.ComponentRef = "Foo"; |
39 | Assert.Equal("Foo", fileTuple.ComponentRef); | 39 | Assert.Equal("Foo", fileSymbol.ComponentRef); |
40 | } | 40 | } |
41 | 41 | ||
42 | [Fact] | 42 | [Fact] |
43 | public void CanCheckNameofField() | 43 | public void CanCheckNameofField() |
44 | { | 44 | { |
45 | var fileTuple = new FileTuple(); | 45 | var fileSymbol = new FileSymbol(); |
46 | Assert.Equal("ComponentRef", fileTuple.Definition.FieldDefinitions[0].Name); | 46 | Assert.Equal("ComponentRef", fileSymbol.Definition.FieldDefinitions[0].Name); |
47 | Assert.Null(fileTuple.Fields[0]); | 47 | Assert.Null(fileSymbol.Fields[0]); |
48 | fileTuple.ComponentRef = "Foo"; | 48 | fileSymbol.ComponentRef = "Foo"; |
49 | Assert.Equal("ComponentRef", fileTuple.Fields[0].Name); | 49 | Assert.Equal("ComponentRef", fileSymbol.Fields[0].Name); |
50 | Assert.Same(fileTuple.Definition.FieldDefinitions[0].Name, fileTuple.Fields[0].Name); | 50 | Assert.Same(fileSymbol.Definition.FieldDefinitions[0].Name, fileSymbol.Fields[0].Name); |
51 | } | 51 | } |
52 | 52 | ||
53 | [Fact] | 53 | [Fact] |
54 | public void CanSetComponentFieldInFileTupleByNew() | 54 | public void CanSetComponentFieldInFileSymbolByNew() |
55 | { | 55 | { |
56 | var fileTuple = new FileTuple(); | 56 | var fileSymbol = new FileSymbol(); |
57 | fileTuple.ComponentRef = "Foo"; | 57 | fileSymbol.ComponentRef = "Foo"; |
58 | Assert.Equal("Foo", fileTuple.ComponentRef); | 58 | Assert.Equal("Foo", fileSymbol.ComponentRef); |
59 | } | 59 | } |
60 | 60 | ||
61 | [Fact] | 61 | [Fact] |
@@ -63,10 +63,10 @@ namespace WixToolsetTest.Data | |||
63 | { | 63 | { |
64 | using (new IntermediateFieldContext("bar")) | 64 | using (new IntermediateFieldContext("bar")) |
65 | { | 65 | { |
66 | var fileTuple = new FileTuple(); | 66 | var fileSymbol = new FileSymbol(); |
67 | fileTuple.ComponentRef = "Foo"; | 67 | fileSymbol.ComponentRef = "Foo"; |
68 | 68 | ||
69 | var field = fileTuple[FileTupleFields.ComponentRef]; | 69 | var field = fileSymbol[FileSymbolFields.ComponentRef]; |
70 | Assert.Equal("Foo", field.AsString()); | 70 | Assert.Equal("Foo", field.AsString()); |
71 | Assert.Equal("bar", field.Context); | 71 | Assert.Equal("bar", field.Context); |
72 | } | 72 | } |
@@ -75,21 +75,21 @@ namespace WixToolsetTest.Data | |||
75 | [Fact] | 75 | [Fact] |
76 | public void CanSetInNestedContext() | 76 | public void CanSetInNestedContext() |
77 | { | 77 | { |
78 | var fileTuple = new FileTuple(); | 78 | var fileSymbol = new FileSymbol(); |
79 | 79 | ||
80 | using (new IntermediateFieldContext("bar")) | 80 | using (new IntermediateFieldContext("bar")) |
81 | { | 81 | { |
82 | fileTuple.ComponentRef = "Foo"; | 82 | fileSymbol.ComponentRef = "Foo"; |
83 | 83 | ||
84 | var field = fileTuple[FileTupleFields.ComponentRef]; | 84 | var field = fileSymbol[FileSymbolFields.ComponentRef]; |
85 | Assert.Equal("Foo", field.AsString()); | 85 | Assert.Equal("Foo", field.AsString()); |
86 | Assert.Equal("bar", field.Context); | 86 | Assert.Equal("bar", field.Context); |
87 | 87 | ||
88 | using (new IntermediateFieldContext("baz")) | 88 | using (new IntermediateFieldContext("baz")) |
89 | { | 89 | { |
90 | fileTuple.ComponentRef = "Foo2"; | 90 | fileSymbol.ComponentRef = "Foo2"; |
91 | 91 | ||
92 | field = fileTuple[FileTupleFields.ComponentRef]; | 92 | field = fileSymbol[FileSymbolFields.ComponentRef]; |
93 | Assert.Equal("Foo2", field.AsString()); | 93 | Assert.Equal("Foo2", field.AsString()); |
94 | Assert.Equal("baz", field.Context); | 94 | Assert.Equal("baz", field.Context); |
95 | 95 | ||
@@ -97,9 +97,9 @@ namespace WixToolsetTest.Data | |||
97 | Assert.Equal("bar", field.PreviousValue.Context); | 97 | Assert.Equal("bar", field.PreviousValue.Context); |
98 | } | 98 | } |
99 | 99 | ||
100 | fileTuple.ComponentRef = "Foo3"; | 100 | fileSymbol.ComponentRef = "Foo3"; |
101 | 101 | ||
102 | field = fileTuple[FileTupleFields.ComponentRef]; | 102 | field = fileSymbol[FileSymbolFields.ComponentRef]; |
103 | Assert.Equal("Foo3", field.AsString()); | 103 | Assert.Equal("Foo3", field.AsString()); |
104 | Assert.Equal("bar", field.Context); | 104 | Assert.Equal("bar", field.Context); |
105 | 105 | ||
@@ -110,26 +110,26 @@ namespace WixToolsetTest.Data | |||
110 | Assert.Equal("bar", field.PreviousValue.PreviousValue.Context); | 110 | Assert.Equal("bar", field.PreviousValue.PreviousValue.Context); |
111 | } | 111 | } |
112 | 112 | ||
113 | fileTuple.ComponentRef = "Foo4"; | 113 | fileSymbol.ComponentRef = "Foo4"; |
114 | 114 | ||
115 | var fieldOutside = fileTuple[FileTupleFields.ComponentRef]; | 115 | var fieldOutside = fileSymbol[FileSymbolFields.ComponentRef]; |
116 | Assert.Equal("Foo4", fieldOutside.AsString()); | 116 | Assert.Equal("Foo4", fieldOutside.AsString()); |
117 | Assert.Null(fieldOutside.Context); | 117 | Assert.Null(fieldOutside.Context); |
118 | } | 118 | } |
119 | 119 | ||
120 | //[Fact] | 120 | //[Fact] |
121 | //public void CanSetComponentFieldInFileTuple() | 121 | //public void CanSetComponentFieldInFileSymbol() |
122 | //{ | 122 | //{ |
123 | // var fileTuple = TupleDefinitions.File.CreateTuple<FileTuple>(); | 123 | // var fileSymbol = SymbolDefinitions.File.CreateSymbol<FileSymbol>(); |
124 | // fileTuple.Component_ = "Foo"; | 124 | // fileSymbol.Component_ = "Foo"; |
125 | // Assert.Equal("Foo", fileTuple.Component_); | 125 | // Assert.Equal("Foo", fileSymbol.Component_); |
126 | //} | 126 | //} |
127 | 127 | ||
128 | //[Fact] | 128 | //[Fact] |
129 | //public void CanThrowOnMismatchTupleType() | 129 | //public void CanThrowOnMismatchSymbolType() |
130 | //{ | 130 | //{ |
131 | // var e = Assert.Throws<InvalidCastException>(() => TupleDefinitions.File.CreateTuple<ComponentTuple>()); | 131 | // var e = Assert.Throws<InvalidCastException>(() => SymbolDefinitions.File.CreateSymbol<ComponentSymbol>()); |
132 | // Assert.Equal("Requested wrong type WixToolset.Data.Tuples.ComponentTuple, actual type WixToolset.Data.Tuples.FileTuple", e.Message); | 132 | // Assert.Equal("Requested wrong type WixToolset.Data.Symbols.ComponentSymbol, actual type WixToolset.Data.Symbols.FileSymbol", e.Message); |
133 | //} | 133 | //} |
134 | } | 134 | } |
135 | } | 135 | } |