aboutsummaryrefslogtreecommitdiff
path: root/src/test/WixToolsetTest.Data/TupleDefinitionFixture.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/WixToolsetTest.Data/TupleDefinitionFixture.cs')
-rw-r--r--src/test/WixToolsetTest.Data/TupleDefinitionFixture.cs135
1 files changed, 0 insertions, 135 deletions
diff --git a/src/test/WixToolsetTest.Data/TupleDefinitionFixture.cs b/src/test/WixToolsetTest.Data/TupleDefinitionFixture.cs
deleted file mode 100644
index cde4a675..00000000
--- a/src/test/WixToolsetTest.Data/TupleDefinitionFixture.cs
+++ /dev/null
@@ -1,135 +0,0 @@
1// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2
3namespace WixToolsetTest.Data
4{
5 using WixToolset.Data;
6 using WixToolset.Data.Symbols;
7 using Xunit;
8
9 public class SymbolDefinitionFixture
10 {
11 [Fact]
12 public void CanCreateFileSymbol()
13 {
14 var symbol = SymbolDefinitions.File.CreateSymbol();
15 Assert.IsType<FileSymbol>(symbol);
16 Assert.Same(SymbolDefinitions.File, symbol.Definition);
17 }
18
19 [Fact]
20 public void CanCreateFileSymbolByName()
21 {
22 var symbol = SymbolDefinitions.ByName("File").CreateSymbol();
23 Assert.IsType<FileSymbol>(symbol);
24 Assert.Same(SymbolDefinitions.File, symbol.Definition);
25 }
26
27 //[Fact]
28 //public void CanCreateFileSymbolByType()
29 //{
30 // var symbol = SymbolDefinitions.CreateSymbol<FileSymbol>();
31 // Assert.Same(SymbolDefinitions.File, symbol.Definition);
32 //}
33
34 [Fact]
35 public void CanSetComponentFieldInFileSymbolByCasting()
36 {
37 var fileSymbol = (FileSymbol)SymbolDefinitions.File.CreateSymbol();
38 fileSymbol.ComponentRef = "Foo";
39 Assert.Equal("Foo", fileSymbol.ComponentRef);
40 }
41
42 [Fact]
43 public void CanCheckNameofField()
44 {
45 var fileSymbol = new FileSymbol();
46 Assert.Equal("ComponentRef", fileSymbol.Definition.FieldDefinitions[0].Name);
47 Assert.Null(fileSymbol.Fields[0]);
48 fileSymbol.ComponentRef = "Foo";
49 Assert.Equal("ComponentRef", fileSymbol.Fields[0].Name);
50 Assert.Same(fileSymbol.Definition.FieldDefinitions[0].Name, fileSymbol.Fields[0].Name);
51 }
52
53 [Fact]
54 public void CanSetComponentFieldInFileSymbolByNew()
55 {
56 var fileSymbol = new FileSymbol();
57 fileSymbol.ComponentRef = "Foo";
58 Assert.Equal("Foo", fileSymbol.ComponentRef);
59 }
60
61 [Fact]
62 public void CanGetContext()
63 {
64 using (new IntermediateFieldContext("bar"))
65 {
66 var fileSymbol = new FileSymbol();
67 fileSymbol.ComponentRef = "Foo";
68
69 var field = fileSymbol[FileSymbolFields.ComponentRef];
70 Assert.Equal("Foo", field.AsString());
71 Assert.Equal("bar", field.Context);
72 }
73 }
74
75 [Fact]
76 public void CanSetInNestedContext()
77 {
78 var fileSymbol = new FileSymbol();
79
80 using (new IntermediateFieldContext("bar"))
81 {
82 fileSymbol.ComponentRef = "Foo";
83
84 var field = fileSymbol[FileSymbolFields.ComponentRef];
85 Assert.Equal("Foo", field.AsString());
86 Assert.Equal("bar", field.Context);
87
88 using (new IntermediateFieldContext("baz"))
89 {
90 fileSymbol.ComponentRef = "Foo2";
91
92 field = fileSymbol[FileSymbolFields.ComponentRef];
93 Assert.Equal("Foo2", field.AsString());
94 Assert.Equal("baz", field.Context);
95
96 Assert.Equal("Foo", (string)field.PreviousValue);
97 Assert.Equal("bar", field.PreviousValue.Context);
98 }
99
100 fileSymbol.ComponentRef = "Foo3";
101
102 field = fileSymbol[FileSymbolFields.ComponentRef];
103 Assert.Equal("Foo3", field.AsString());
104 Assert.Equal("bar", field.Context);
105
106 Assert.Equal("Foo2", (string)field.PreviousValue);
107 Assert.Equal("baz", field.PreviousValue.Context);
108
109 Assert.Equal("Foo", (string)field.PreviousValue.PreviousValue);
110 Assert.Equal("bar", field.PreviousValue.PreviousValue.Context);
111 }
112
113 fileSymbol.ComponentRef = "Foo4";
114
115 var fieldOutside = fileSymbol[FileSymbolFields.ComponentRef];
116 Assert.Equal("Foo4", fieldOutside.AsString());
117 Assert.Null(fieldOutside.Context);
118 }
119
120 //[Fact]
121 //public void CanSetComponentFieldInFileSymbol()
122 //{
123 // var fileSymbol = SymbolDefinitions.File.CreateSymbol<FileSymbol>();
124 // fileSymbol.Component_ = "Foo";
125 // Assert.Equal("Foo", fileSymbol.Component_);
126 //}
127
128 //[Fact]
129 //public void CanThrowOnMismatchSymbolType()
130 //{
131 // var e = Assert.Throws<InvalidCastException>(() => SymbolDefinitions.File.CreateSymbol<ComponentSymbol>());
132 // Assert.Equal("Requested wrong type WixToolset.Data.Symbols.ComponentSymbol, actual type WixToolset.Data.Symbols.FileSymbol", e.Message);
133 //}
134 }
135}