Skip to content

Commit 32c0a1b

Browse files
committed
fix assert config
1 parent 920c515 commit 32c0a1b

1 file changed

Lines changed: 10 additions & 22 deletions

File tree

integration/csharp/Program.cs

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ private static async Task AssertGetEntries(Client client)
6161
throw new Exception("Test assertGetEntries failed: ItemsPerPage, got: " + todos.ItemsPerPage);
6262
}
6363

64-
if (todos.Entry.Count != 2) {
65-
throw new Exception("Test assertGetEntries failed: Entry, got: " + todos.Entry.Count);
64+
if (todos.Entry?.Count != 2) {
65+
throw new Exception("Test assertGetEntries failed: Entry, got: " + todos.Entry?.Count);
6666
}
6767

6868
if (todos.Entry[0].Title != "foo") {
@@ -107,42 +107,30 @@ private static async Task AssertGetFormConfig(Client client)
107107
{
108108
CommonFormContainer form = await client.Test().GetFormConfig();
109109

110-
if (form.Elements.Count != 3) {
111-
throw new Exception("Test assertForm failed: Elements, got: " + form.Elements.Count);
110+
if (form.Elements?.Count != 3) {
111+
throw new Exception("Test assertGetFormConfig failed: Elements, got: " + form.Elements?.Count);
112112
}
113113

114114
if (form.Elements[0].GetType().Name != "CommonFormElementInput") {
115-
throw new Exception("Test assertForm failed: Elements.0, got: " + form.Elements[0].GetType().Name);
116-
}
117-
118-
if (form.Elements[0].Element != "input") {
119-
throw new Exception("Test assertForm failed: Elements.0.Element, got: " + form.Elements[0].Element);
115+
throw new Exception("Test assertGetFormConfig failed: Elements.0, got: " + form.Elements[0].GetType().Name);
120116
}
121117

122118
CommonFormElementInput input = (CommonFormElementInput) form.Elements[0];
123119
if (input.Type != "text") {
124-
throw new Exception("Test assertForm failed: Elements.0.Type, got: " + input.Type);
120+
throw new Exception("Test assertGetFormConfig failed: Elements.0.Type, got: " + input.Type);
125121
}
126122

127123
if (form.Elements[1].GetType().Name != "CommonFormElementSelect") {
128-
throw new Exception("Test assertForm failed: Elements.1, got: " + form.Elements[1].GetType().Name);
129-
}
130-
131-
if (form.Elements[1].Element != "select") {
132-
throw new Exception("Test assertForm failed: Elements.1.Element, got: " + form.Elements[1].Element);
124+
throw new Exception("Test assertGetFormConfig failed: Elements.1, got: " + form.Elements[1].GetType().Name);
133125
}
134126

135127
CommonFormElementSelect select = (CommonFormElementSelect) form.Elements[1];
136-
if (select.Options.Count != 2) {
137-
throw new Exception("Test assertForm failed: Elements.1.Options, got: " + select.Options.Count);
128+
if (select.Options?.Count != 2) {
129+
throw new Exception("Test assertGetFormConfig failed: Elements.1.Options, got: " + select.Options?.Count);
138130
}
139131

140132
if (form.Elements[2].GetType().Name != "CommonFormElementTextArea") {
141-
throw new Exception("Test assertForm failed: Elements.2, got: " + form.Elements[2].GetType().Name);
142-
}
143-
144-
if (form.Elements[2].Element != "textarea") {
145-
throw new Exception("Test assertForm failed: Elements.2.Element, got: " + form.Elements[2].Element);
133+
throw new Exception("Test assertGetFormConfig failed: Elements.2, got: " + form.Elements[2].GetType().Name);
146134
}
147135
}
148136

0 commit comments

Comments
 (0)