Bump xunit from 2.6.1 to 2.6.2 in /samples (#1542)

* Bump xunit from 2.6.1 to 2.6.2 in /samples

Bumps [xunit](https://github.com/xunit/xunit) from 2.6.1 to 2.6.2.
- [Commits](https://github.com/xunit/xunit/compare/2.6.1...2.6.2)

---
updated-dependencies:
- dependency-name: xunit
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update for `xUnit2021` and `xUnit1012` Analyzers

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
This commit is contained in:
dependabot[bot] 2023-11-20 19:17:58 +00:00 коммит произвёл GitHub
Родитель db991b7248
Коммит 81741d913a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
12 изменённых файлов: 28 добавлений и 26 удалений

Просмотреть файл

@ -35,8 +35,10 @@
CS1711: XML comment has a typeparam tag, but there is no type parameter by that name
CS1712: Type parameter has no matching typeparam tag in the XML comment
CS1723: XML comment has cref attribute that refers to a type parameter
CS1734: XML comment has a paramref tag, but there is no parameter by that name -->
<WarningsAsErrors>nullable,CS0419,CS1570,CS1571,CS1572,CS1573,CS1574,CS1580,CS1581,CS1584,CS1587,CS1589,CS1590,CS1591,CS1592,CS1598,CS1658,CS1710,CS1711,CS1712,CS1723,CS1734</WarningsAsErrors>
CS1734: XML comment has a paramref tag, but there is no parameter by that name
xUnit1012: Null should not be used for type parameter
xUnit2021: Assert.ThrowsAsync is async. The resulting task should be awaited -->
<WarningsAsErrors>nullable,CS0419,CS1570,CS1571,CS1572,CS1573,CS1574,CS1580,CS1581,CS1584,CS1587,CS1589,CS1590,CS1591,CS1592,CS1598,CS1658,CS1710,CS1711,CS1712,CS1723,CS1734,xUnit1012,xUnit2021</WarningsAsErrors>
</PropertyGroup>
<ItemGroup>

Просмотреть файл

@ -15,7 +15,7 @@
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.XUnit" Version="1.1.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing.XUnit" Version="1.1.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.6.1" />
<PackageReference Include="xunit" Version="2.6.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.4" PrivateAssets="All" />
<PackageReference Include="coverlet.collector" Version="6.0.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.CodeAnalysis" Version="4.7.0" />

Просмотреть файл

@ -220,7 +220,7 @@ public class SnackbarTests : BaseTest
}
[Fact]
public void SnackbarNullValuesThrowArgumentNullException()
public async Task SnackbarNullValuesThrowArgumentNullException()
{
#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type.
Assert.Throws<ArgumentNullException>(() => new Snackbar
@ -233,8 +233,8 @@ public class SnackbarTests : BaseTest
});
Assert.Throws<ArgumentNullException>(() => Snackbar.Make(null));
Assert.Throws<ArgumentNullException>(() => Snackbar.Make(string.Empty, actionButtonText: null));
Assert.ThrowsAsync<ArgumentNullException>(() => new Button().DisplaySnackbar(null));
Assert.ThrowsAsync<ArgumentNullException>(() => new Button().DisplaySnackbar(string.Empty, actionButtonText: null));
await Assert.ThrowsAsync<ArgumentNullException>(() => new Button().DisplaySnackbar(null));
await Assert.ThrowsAsync<ArgumentNullException>(() => new Button().DisplaySnackbar(string.Empty, actionButtonText: null));
#pragma warning restore CS8625 // Cannot convert null literal to non-nullable reference type.
}
}

Просмотреть файл

@ -32,7 +32,7 @@ public class CharactersValidationBehaviorTests : BaseTest
[InlineData(CharacterType.UppercaseLatinLetter, 1, int.MaxValue, "КИРИЛЛИЦА", false)]
[InlineData(CharacterType.LatinLetter, 1, int.MaxValue, "Это Кириллица!", false)]
[InlineData(CharacterType.Whitespace, 0, 0, "WWWWWW WWWWW", false)]
public async Task IsValid(CharacterType characterType, int minimumCharactersNumber, int maximumCharactersNumber, string value, bool expectedValue)
public async Task IsValid(CharacterType characterType, int minimumCharactersNumber, int maximumCharactersNumber, string? value, bool expectedValue)
{
// Arrange
var behavior = new CharactersValidationBehavior

Просмотреть файл

@ -32,7 +32,7 @@ public class MultiValidationBehaviorTests : BaseTest
[InlineData(CharacterType.UppercaseLatinLetter, 1, int.MaxValue, "КИРИЛЛИЦА", "aaa", false)]
[InlineData(CharacterType.LatinLetter, 1, int.MaxValue, "Это Кириллица!", "!", false)]
[InlineData(CharacterType.Whitespace, 0, 0, "WWWWWW WWWWW", "WWW", false)]
public async Task IsValid(CharacterType characterType, int minimumCharactersNumber, int maximumCharactersNumber, string value, string requiredString, bool expectedValue, bool exactMatch = false)
public async Task IsValid(CharacterType characterType, int minimumCharactersNumber, int maximumCharactersNumber, string? value, string requiredString, bool expectedValue, bool exactMatch = false)
{
// Arrange
var characterValidationBehavior = new CharactersValidationBehavior

Просмотреть файл

@ -13,7 +13,7 @@
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Nito.AsyncEx" Version="5.1.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.6.1" />
<PackageReference Include="xunit" Version="2.6.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.4" PrivateAssets="All" />
<PackageReference Include="coverlet.collector" Version="6.0.0" PrivateAssets="All" />
</ItemGroup>

Просмотреть файл

@ -105,7 +105,7 @@ public class CompareConverterTests : BaseOneWayConverterTest<CompareConverter>
[Theory]
[InlineData(20d, null, TrueTestObject, FalseTestObject)]
public void CompareConverterInvalidValuesThrowArgumentNullException(IComparable value, IComparable comparingValue, object trueObject, object falseObject)
public void CompareConverterInvalidValuesThrowArgumentNullException(IComparable value, IComparable? comparingValue, object trueObject, object falseObject)
{
var compareConverter = new CompareConverter()
{
@ -121,7 +121,7 @@ public class CompareConverterTests : BaseOneWayConverterTest<CompareConverter>
[Theory]
[InlineData(20d, 20d, TrueTestObject, null)]
[InlineData(20d, 20d, null, FalseTestObject)]
public void CompareConverterInvalidValuesThrowInvalidOperationException(IComparable value, IComparable comparingValue, object trueObject, object falseObject)
public void CompareConverterInvalidValuesThrowInvalidOperationException(IComparable value, IComparable comparingValue, object? trueObject, object? falseObject)
{
var compareConverter = new CompareConverter()
{

Просмотреть файл

@ -67,7 +67,7 @@ public class EnumToBoolConverterTests : BaseOneWayConverterTest<EnumToBoolConver
[InlineData(null, TestFlaggedEnumForEnumToBoolConverter.Two, TestFlaggedEnumForEnumToBoolConverter.One | TestFlaggedEnumForEnumToBoolConverter.Three, false)]
[InlineData(null, TestFlaggedEnumForEnumToBoolConverter.One | TestFlaggedEnumForEnumToBoolConverter.Three, TestFlaggedEnumForEnumToBoolConverter.One | TestFlaggedEnumForEnumToBoolConverter.Three, true)]
[InlineData(null, TestFlaggedEnumForEnumToBoolConverter.One | TestFlaggedEnumForEnumToBoolConverter.Two | TestFlaggedEnumForEnumToBoolConverter.Three, TestFlaggedEnumForEnumToBoolConverter.One | TestFlaggedEnumForEnumToBoolConverter.Three, false)]
public void EnumToBoolConvert_Validation(object?[]? trueValues, Enum value, Enum parameter, bool expectedResult)
public void EnumToBoolConvert_Validation(object?[]? trueValues, Enum value, Enum? parameter, bool expectedResult)
{
var enumToBoolConverter = new EnumToBoolConverter();
trueValues?.OfType<Enum>().ToList().ForEach(fe => enumToBoolConverter.TrueValues.Add(fe));

Просмотреть файл

@ -197,7 +197,7 @@ public class IsInRangeConverterTests : BaseOneWayConverterTest<IsInRangeConverte
[Theory]
[InlineData(20d, 1d, 30d, null, FalseTestObject)]
[InlineData(20d, 1d, 30d, TrueTestObject, null)]
public void InvalidIComparableThrowInvalidOperationException(IComparable value, IComparable comparingMinValue, IComparable comparingMaxValue, object trueObject, object falseObject)
public void InvalidIComparableThrowInvalidOperationException(IComparable value, IComparable comparingMinValue, IComparable comparingMaxValue, object? trueObject, object? falseObject)
{
IsInRangeConverter isInRangeConverter = new()
{
@ -212,7 +212,7 @@ public class IsInRangeConverterTests : BaseOneWayConverterTest<IsInRangeConverte
[Theory]
[InlineData(20d, null, null, TrueTestObject, FalseTestObject)]
public void InvalidValuesThrowArgumentException(IComparable value, IComparable comparingMinValue, IComparable comparingMaxValue, object trueObject, object falseObject)
public void InvalidValuesThrowArgumentException(IComparable value, IComparable? comparingMinValue, IComparable? comparingMaxValue, object trueObject, object falseObject)
{
IsInRangeConverter isInRangeConverter = new()
{
@ -250,7 +250,7 @@ public class IsInRangeConverterTests : BaseOneWayConverterTest<IsInRangeConverte
[InlineData(20d, 10d, null, TrueTestObject, FalseTestObject, TrueTestObject)]
[InlineData(40d, null, 30d, TrueTestObject, FalseTestObject, FalseTestObject)]
[InlineData(5d, 10d, null, TrueTestObject, FalseTestObject, FalseTestObject)]
public void NullToMinValueIsInRangeConverterConvertFrom(IComparable value, IComparable comparingMinValue, IComparable comparingMaxValue, object trueObject, object falseObject, object expectedResult)
public void NullToMinValueIsInRangeConverterConvertFrom(IComparable value, IComparable? comparingMinValue, IComparable? comparingMaxValue, object trueObject, object falseObject, object expectedResult)
{
IsInRangeConverter isInRangeConverter = new()
{
@ -267,7 +267,7 @@ public class IsInRangeConverterTests : BaseOneWayConverterTest<IsInRangeConverte
[Theory]
[InlineData(20d, 10d, 30d, null, null, true)]
[InlineData(5d, 10d, 30d, null, null, false)]
public void ReturnObjectsNullExpectBoolReturn(IComparable value, IComparable comparingMinValue, IComparable comparingMaxValue, object trueObject, object falseObject, object expectedResult)
public void ReturnObjectsNullExpectBoolReturn(IComparable value, IComparable comparingMinValue, IComparable comparingMaxValue, object? trueObject, object? falseObject, object expectedResult)
{
IsInRangeConverter isInRangeConverter = new()
{

Просмотреть файл

@ -31,7 +31,7 @@ public class VariableMultiValueConverterTests : BaseTest
[InlineData(null, MultiBindingCondition.GreaterThan, false)]
[InlineData(null, MultiBindingCondition.LessThan, false)]
[InlineData(null, MultiBindingCondition.None, false)]
public void VariableMultiConverter(object[] value, MultiBindingCondition type, object expectedResult, int count = 0)
public void VariableMultiConverter(object[]? value, MultiBindingCondition type, object expectedResult, int count = 0)
{
var variableMultiConverter = new VariableMultiValueConverter() { ConditionType = type, Count = count };
var result = variableMultiConverter.Convert(value, typeof(bool), null, CultureInfo.CurrentCulture);

Просмотреть файл

@ -347,7 +347,7 @@ public class GravatarImageSourceTests : BaseHandlerTest
{
CancellationTokenSource cts = new();
var gravatarImageSource = new GravatarImageSource();
Stream? stream = await gravatarImageSource.Stream(cts.Token);
await using var stream = await gravatarImageSource.Stream(cts.Token);
stream.Should().NotBeNull();
}

Просмотреть файл

@ -27,23 +27,23 @@ public class PopupServiceTests : BaseHandlerTest
}
[Fact]
public void ShowPopupAsyncWithNullViewModelShouldThrowArgumentNullException()
public async Task ShowPopupAsyncWithNullViewModelShouldThrowArgumentNullException()
{
var popupService = new PopupService(new MockServiceProvider());
#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type.
Assert.ThrowsAsync<ArgumentNullException>(() =>
await Assert.ThrowsAsync<ArgumentNullException>(() =>
popupService.ShowPopupAsync<INotifyPropertyChanged>(viewModel: null, CancellationToken.None));
#pragma warning restore CS8625 // Cannot convert null literal to non-nullable reference type.
}
[Fact]
public void ShowPopupAsyncWithNullOnPresentingShouldThrowArgumentNullException()
public async Task ShowPopupAsyncWithNullOnPresentingShouldThrowArgumentNullException()
{
var popupService = new PopupService(new MockServiceProvider());
#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type.
Assert.ThrowsAsync<ArgumentNullException>(() =>
await Assert.ThrowsAsync<ArgumentNullException>(() =>
popupService.ShowPopupAsync<INotifyPropertyChanged>(onPresenting: null, CancellationToken.None));
#pragma warning restore CS8625 // Cannot convert null literal to non-nullable reference type.
}
@ -87,25 +87,25 @@ public class PopupServiceTests : BaseHandlerTest
}
[Fact]
public void ShowPopupAsyncWithMismatchedViewModelTypeShouldThrowInvalidOperationException()
public async Task ShowPopupAsyncWithMismatchedViewModelTypeShouldThrowInvalidOperationException()
{
var popupService = new PopupService(new MockServiceProvider());
#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type.
Assert.ThrowsAsync<ArgumentNullException>(() =>
await Assert.ThrowsAsync<ArgumentNullException>(() =>
popupService.ShowPopupAsync<INotifyPropertyChanged>(viewModel: null, CancellationToken.None));
#pragma warning restore CS8625 // Cannot convert null literal to non-nullable reference type.
}
[Fact(Timeout = (int)TestDuration.Short)]
public void ShowPopupAsyncShouldThrowInvalidOperationExceptionWhenNoViewModelIsRegistered()
public async Task ShowPopupAsyncShouldThrowInvalidOperationExceptionWhenNoViewModelIsRegistered()
{
var popupInstance = new MockMismatchedPopup();
var popupViewModel = new MockPageViewModel();
SetupTest(popupInstance, () => popupViewModel, out var popupService);
Assert.ThrowsAsync<InvalidOperationException>(() => popupService.ShowPopupAsync<MockPageViewModel>(CancellationToken.None));
await Assert.ThrowsAsync<InvalidOperationException>(() => popupService.ShowPopupAsync<MockPageViewModel>(CancellationToken.None));
}
[Fact(Timeout = (int)TestDuration.Medium)]