Skip to content

Commit

Permalink
Fixed unnecessary warnings in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
quigamdev committed May 19, 2024
1 parent 7aac0ea commit b40ec76
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/Samples/Tests/Tests/Control/CheckBoxTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public void Control_CheckBox_CheckedItemsEmpty()
browser.WaitUntilDotvvmInited();

var checkBoxes = browser.FindElements("checkbox", SelectByDataUi);
Assert.Equal(0, checkBoxes.Count);
Assert.Empty(checkBoxes);
void UpdateData() => browser.WaitFor(() => {
var button = browser.First("btn-update", SelectByDataUi).Click();
var repeater = browser.Single("repeater", SelectByDataUi);
Expand Down
10 changes: 5 additions & 5 deletions src/Samples/Tests/Tests/Control/IncludeInPagePropertyTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public void Control_IncludeInPageProperty_IncludeInPage_GridView()
AssertUI.ContainsElement(gridView, "thead");
AssertUI.ContainsElement(gridView, "tbody");
}, browser => {
Assert.Equal(0, browser.FindElements("gridView", this.SelectByDataUi).Count);
Assert.Empty(browser.FindElements("gridView", this.SelectByDataUi));
});
}

Expand All @@ -37,8 +37,8 @@ public void Control_IncludeInPageProperty_IncludeInPage_GridViewEmptyDataTemplat
AssertUI.IsDisplayed(message);
AssertUI.TextEquals(message, "There are no Customers to display");
}, browser => {
Assert.Equal(0, browser.FindElements(gridViewDataUi).Count);
Assert.Equal(0, browser.FindElements(messageDataUi).Count);
Assert.Empty(browser.FindElements(gridViewDataUi));
Assert.Empty(browser.FindElements(messageDataUi));
});
}

Expand All @@ -51,7 +51,7 @@ public void Control_IncludeInPageProperty_IncludeInPage_Literal()
AssertUI.IsDisplayed(literal);
AssertUI.TextEquals(literal, "Test 1");
}, browser => {
Assert.Equal(0, browser.FindElements("literal", this.SelectByDataUi).Count);
Assert.Empty(browser.FindElements("literal", this.SelectByDataUi));
});
}

Expand All @@ -67,7 +67,7 @@ public void Control_IncludeInPageProperty_IncludeInPage_LiteralsInRepeater()
AssertUI.IsDisplayed(literal);
}
}, browser => {
Assert.Equal(0, browser.FindElements("literal-repeater", this.SelectByDataUi).Count);
Assert.Empty(browser.FindElements("literal-repeater", this.SelectByDataUi));
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/Samples/Tests/Tests/Control/ListBoxTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void Control_MultiSelect()
browser.NavigateToUrl(SamplesRouteUrls.ControlSamples_ListBox_ListBox);

var initialSelectedElements = browser.FindElements("li");
Assert.Equal(0, initialSelectedElements.Count);
Assert.Empty(initialSelectedElements);

AssertUI.HasAttribute(browser.Single("select[data-ui=multiple]"), "multiple");

Expand Down
8 changes: 4 additions & 4 deletions src/Samples/Tests/Tests/Control/RepeaterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public void Control_Repeater_DataSourceNull()
var clientRepeater = browser.Single("client-repeater", this.SelectByDataUi);
var serverRepeater = browser.Single("server-repeater", this.SelectByDataUi);

Assert.Equal(0, clientRepeater.Children.Count);
Assert.Equal(0, serverRepeater.Children.Count);
Assert.Empty(clientRepeater.Children);
Assert.Empty(serverRepeater.Children);

var button = browser.Single("set-collection-button", this.SelectByDataUi);
button.Click();
Expand Down Expand Up @@ -260,8 +260,8 @@ public void Control_Repeater_RequiredResource()
var clientRepeater = browser.Single("client-repeater", this.SelectByDataUi);
var serverRepeater = browser.Single("server-repeater", this.SelectByDataUi);

Assert.Equal(0, clientRepeater.Children.Count);
Assert.Equal(0, serverRepeater.Children.Count);
Assert.Empty(clientRepeater.Children);
Assert.Empty(serverRepeater.Children);
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/Samples/Tests/Tests/Control/UpdateProgressTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public void Control_UpdateProgress_SPA_Redirect(string route)
Thread.Sleep(50);
}

Assert.True(false, "SPA 2 page did not load in time");
Assert.Fail("SPA 2 page did not load in time");
});
}
[Fact]
Expand Down
8 changes: 4 additions & 4 deletions src/Samples/Tests/Tests/Feature/StaticCommandTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -607,19 +607,19 @@ public void Feature_Lambda_Expression_Static_Command_First_Or_Last()
browser.NavigateToUrl(SamplesRouteUrls.FeatureSamples_LambdaExpressions_StaticCommands);

var rows = GetSortedRow(browser, "First customer");
browser.WaitFor(() => Assert.Equal(1, rows.Count), 500);
browser.WaitFor(() => Assert.Single(rows), 500);
Assert.Equal(rowWithId1.ToList(), RowContent(rows, 0, new List<int> { 0, 1, 2, 3, 4, 5 }).ToList());

rows = GetSortedRow(browser, "Last customer");
browser.WaitFor(() => Assert.Equal(1, rows.Count), 500);
browser.WaitFor(() => Assert.Single(rows), 500);
Assert.Equal(rowWithId10.ToList(), RowContent(rows, 0, new List<int> { 0, 1, 2, 3, 4, 5 }).ToList());

rows = GetSortedRow(browser, "First blue customer");
browser.WaitFor(() => Assert.Equal(1, rows.Count), 500);
browser.WaitFor(() => Assert.Single(rows), 500);
Assert.Equal(rowWithId3.ToList(), RowContent(rows, 0, new List<int> { 0, 1, 2, 3, 4, 5 }).ToList());

rows = GetSortedRow(browser, "Last red customer");
browser.WaitFor(() => Assert.Equal(1, rows.Count), 500);
browser.WaitFor(() => Assert.Single(rows), 500);
Assert.Equal(rowWithId8.ToList(), RowContent(rows, 0, new List<int> { 0, 1, 2, 3, 4, 5 }).ToList());
});
}
Expand Down
8 changes: 4 additions & 4 deletions src/Samples/Tests/Tests/Feature/ValidationSummaryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,23 @@ public void Control_ValidationSummary_IncludeErrorsFromTarget(string url)
browser.NavigateToUrl(url);

var summary = browser.First("[data-ui=validationSummary]");
browser.WaitFor(() => Assert.Equal(0, summary.Children.Count), 1000);
browser.WaitFor(() => Assert.Empty(summary.Children), 1000);

var loginButton = browser.First("[data-ui=login-button]");
loginButton.Click();
browser.WaitFor(() => Assert.Equal(2, summary.Children.Count), 1000);

browser.First("[data-ui=nick-textbox]").SendKeys("Mike");
loginButton.Click();
browser.WaitFor(() => Assert.Equal(1, summary.Children.Count), 1000);
browser.WaitFor(() => Assert.Single(summary.Children), 1000);

browser.First("[data-ui=password-textbox]").SendKeys("123");
loginButton.Click();
browser.WaitFor(() => Assert.Equal(1, summary.Children.Count), 1000);
browser.WaitFor(() => Assert.Single(summary.Children), 1000);

browser.First("[data-ui=password-textbox]").SendKeys("4");
loginButton.Click();
browser.WaitFor(() => Assert.Equal(0, summary.Children.Count), 1000);
browser.WaitFor(() => Assert.Empty(summary.Children), 1000);
});
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/Samples/Tests/Tests/Feature/ValidationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -699,26 +699,26 @@ public void Feature_Validation_CustomValidation()
var textbox = browser.First("[data-ui=name-textbox]");

submitButton.Click();
Assert.Equal(0, validationSummary.Children.Count);
Assert.Empty(validationSummary.Children);
AssertUI.HasNotClass(textbox, "has-error");

textbox.SendKeys("123");
submitButton.Click();
AssertUI.HasClass(textbox, "has-error");
Assert.Equal(1, validationSummary.Children.Count);
Assert.Single(validationSummary.Children);

textbox.Clear();
textbox.SendKeys("Ted");
submitButton.Click();
Assert.Equal(0, validationSummary.Children.Count);
Assert.Empty(validationSummary.Children);
AssertUI.HasNotClass(textbox, "has-error");

textbox.SendKeys("123");
browser.First("[data-ui=notation-checkbox]").Click();
submitButton.Click();

AssertUI.HasClass(textbox, "has-error");
Assert.Equal(1, validationSummary.Children.Count);
Assert.Single(validationSummary.Children);
});
}

Expand All @@ -731,7 +731,7 @@ public void Feature_Validation_CollectionAsValidationTarget_AutomaticValidation(
var validateButton = browser.First("[data-ui=validation-button]");
var validationSummary = browser.First("[data-ui=validation-summary]");

Assert.Equal(0, validationSummary.Children.Count);
Assert.Empty(validationSummary.Children);

validateButton.Click();
Assert.Equal(2, validationSummary.Children.Count);
Expand Down

0 comments on commit b40ec76

Please sign in to comment.