Use new C# new initialization for vars

This commit is contained in:
michael-hawker 2022-10-20 14:00:22 -07:00 коммит произвёл Michael Hawker MSFT (XAML Llama)
Родитель aa39ee5d70
Коммит 0e3b4e0b64
1 изменённых файлов: 10 добавлений и 10 удалений

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

@ -19,9 +19,9 @@ namespace UnitTests.Converters
[UITestMethod]
public void Test_TaskResultConverter_Instance_Int32()
{
var converter = new TaskResultConverter();
TaskResultConverter converter = new();
TaskCompletionSource<int> tcs = new TaskCompletionSource<int>();
TaskCompletionSource<int> tcs = new();
Assert.AreEqual(null, converter.Convert(tcs.Task, null, null, null));
@ -46,9 +46,9 @@ namespace UnitTests.Converters
[UITestMethod]
public void Test_TaskResultConverter_Instance_String()
{
var converter = new TaskResultConverter();
TaskResultConverter converter = new();
TaskCompletionSource<string> tcs = new TaskCompletionSource<string>();
TaskCompletionSource<string> tcs = new();
Assert.AreEqual(null, converter.Convert(tcs.Task, null, null, null));
@ -73,7 +73,7 @@ namespace UnitTests.Converters
[UITestMethod]
public void Test_TaskResultConverter_Instance_UnsetValue()
{
var converter = new TaskResultConverter();
TaskResultConverter converter = new();
Assert.AreEqual(DependencyProperty.UnsetValue, converter.Convert(null, null, null, null));
Assert.AreEqual(DependencyProperty.UnsetValue, converter.Convert("Hello world", null, null, null));
@ -83,9 +83,9 @@ namespace UnitTests.Converters
[UITestMethod]
public void Test_TaskResultConverter_Instance_Null()
{
var converter = new TaskResultConverter();
TaskResultConverter converter = new();
var cts = new CancellationTokenSource();
CancellationTokenSource cts = new();
cts.Cancel();
@ -93,11 +93,11 @@ namespace UnitTests.Converters
Assert.AreEqual(null, converter.Convert(Task.FromException(new Exception()), null, null, null));
Assert.AreEqual(null, converter.Convert(Task.CompletedTask, null, null, null));
TaskCompletionSource<int> tcs1 = new TaskCompletionSource<int>();
TaskCompletionSource<int> tcs1 = new();
Assert.AreEqual(null, converter.Convert(tcs1.Task, null, null, null));
TaskCompletionSource<string> tcs2 = new TaskCompletionSource<string>();
TaskCompletionSource<string> tcs2 = new();
Assert.AreEqual(null, converter.Convert(tcs2.Task, null, null, null));
}
@ -107,7 +107,7 @@ namespace UnitTests.Converters
[ExpectedException(typeof(NotImplementedException))]
public void Test_TaskResultConverter_Instance_ConvertBack()
{
var converter = new TaskResultConverter();
TaskResultConverter converter = new();
Assert.AreEqual(null, converter.ConvertBack(null, null, null, null));
}