Skip to content

Commit 3de211a

Browse files
Update NuGet Packages in Sample
1 parent d0951d4 commit 3de211a

File tree

16 files changed

+17
-100
lines changed

16 files changed

+17
-100
lines changed

Src/AsyncAwaitBestPractices.MVVM/AsyncCommand.cs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,12 @@ namespace AsyncAwaitBestPractices.MVVM
99
/// </summary>
1010
public sealed class AsyncCommand<T> : IAsyncCommand<T>
1111
{
12-
#region Constant Fields
1312
readonly Func<T, Task> _execute;
1413
readonly Func<object?, bool> _canExecute;
1514
readonly Action<Exception>? _onException;
1615
readonly bool _continueOnCapturedContext;
1716
readonly WeakEventManager _weakEventManager = new WeakEventManager();
18-
#endregion
1917

20-
#region Constructors
2118
/// <summary>
2219
/// Initializes a new instance of the <see cref="T:TaskExtensions.MVVM.AsyncCommand`1"/> class.
2320
/// </summary>
@@ -35,9 +32,7 @@ public AsyncCommand(Func<T, Task> execute,
3532
_onException = onException;
3633
_continueOnCapturedContext = continueOnCapturedContext;
3734
}
38-
#endregion
3935

40-
#region Events
4136
/// <summary>
4237
/// Occurs when changes occur that affect whether or not the command should execute
4338
/// </summary>
@@ -46,9 +41,7 @@ public event EventHandler CanExecuteChanged
4641
add => _weakEventManager.AddEventHandler(value);
4742
remove => _weakEventManager.RemoveEventHandler(value);
4843
}
49-
#endregion
5044

51-
#region Methods
5245
/// <summary>
5346
/// Determines whether the command can execute in its current state
5447
/// </summary>
@@ -79,23 +72,19 @@ void ICommand.Execute(object parameter)
7972
else
8073
throw new InvalidCommandParameterException(typeof(T), parameter!.GetType());
8174
}
82-
#endregion
8375
}
8476

8577
/// <summary>
8678
/// An implmentation of IAsyncCommand. Allows Commands to safely be used asynchronously with Task.
8779
/// </summary>
8880
public sealed class AsyncCommand : IAsyncCommand
8981
{
90-
#region Constant Fields
9182
readonly Func<Task> _execute;
9283
readonly Func<object?, bool> _canExecute;
9384
readonly Action<Exception>? _onException;
9485
readonly bool _continueOnCapturedContext;
9586
readonly WeakEventManager _weakEventManager = new WeakEventManager();
96-
#endregion
9787

98-
#region Constructors
9988
/// <summary>
10089
/// Initializes a new instance of the <see cref="T:TaskExtensions.MVVM.AsyncCommand`1"/> class.
10190
/// </summary>
@@ -113,9 +102,7 @@ public AsyncCommand(Func<Task> execute,
113102
_onException = onException;
114103
_continueOnCapturedContext = continueOnCapturedContext;
115104
}
116-
#endregion
117105

118-
#region Events
119106
/// <summary>
120107
/// Occurs when changes occur that affect whether or not the command should execute
121108
/// </summary>
@@ -124,9 +111,7 @@ public event EventHandler CanExecuteChanged
124111
add => _weakEventManager.AddEventHandler(value);
125112
remove => _weakEventManager.RemoveEventHandler(value);
126113
}
127-
#endregion
128114

129-
#region Methods
130115
/// <summary>
131116
/// Determines whether the command can execute in its current state
132117
/// </summary>
@@ -146,6 +131,5 @@ public event EventHandler CanExecuteChanged
146131
public Task ExecuteAsync() => _execute();
147132

148133
void ICommand.Execute(object parameter) => _execute().SafeFireAndForget(_continueOnCapturedContext, _onException);
149-
#endregion
150134
}
151135
}

Src/AsyncAwaitBestPractices.UnitTests/AsyncAwaitBestPractices.UnitTests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</PropertyGroup>
1111
<ItemGroup>
1212
<PackageReference Include="nunit" Version="3.12.0" />
13-
<PackageReference Include="NUnit3TestAdapter" Version="3.13.0" />
13+
<PackageReference Include="NUnit3TestAdapter" Version="3.14.0" />
1414
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
1515
</ItemGroup>
1616
<ItemGroup>

Src/AsyncAwaitBestPractices.UnitTests/BaseTest.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ namespace AsyncAwaitBestPractices.UnitTests
55
{
66
abstract class BaseTest
77
{
8-
#region Events
98
protected event EventHandler TestEvent
109
{
1110
add => TestWeakEventManager.AddEventHandler(value);
@@ -17,15 +16,11 @@ protected event EventHandler<string> TestStringEvent
1716
add => TestStringWeakEventManager.AddEventHandler(value);
1817
remove => TestStringWeakEventManager.RemoveEventHandler(value);
1918
}
20-
#endregion
2119

22-
#region Properties
2320
protected const int Delay = 500;
2421
protected WeakEventManager TestWeakEventManager { get; } = new WeakEventManager();
2522
protected WeakEventManager<string> TestStringWeakEventManager { get; } = new WeakEventManager<string>();
26-
#endregion
2723

28-
#region Methods
2924
protected Task NoParameterTask() => Task.Delay(Delay);
3025
protected Task IntParameterTask(int delay) => Task.Delay(delay);
3126
protected Task StringParameterTask(string text) => Task.Delay(Delay);
@@ -53,6 +48,5 @@ protected bool CanExecuteDynamic(object? booleanParameter)
5348

5449
throw new InvalidCastException();
5550
}
56-
#endregion
5751
}
5852
}

Src/AsyncAwaitBestPractices.UnitTests/WeakEventManager/Tests_WeakEventManager_Action.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,14 @@ namespace AsyncAwaitBestPractices.UnitTests
55
{
66
class Tests_WeakEventManager_Action : BaseTest
77
{
8-
#region Constant Fields
98
readonly WeakEventManager _actionEventManager = new WeakEventManager();
10-
#endregion
119

12-
#region Events
1310
public event Action ActionEvent
1411
{
1512
add => _actionEventManager.AddEventHandler(value);
1613
remove => _actionEventManager.RemoveEventHandler(value);
1714
}
18-
#endregion
1915

20-
21-
#region Methods
2216
[Test]
2317
public void WeakEventManagerAction_HandleEvent_ValidImplementation()
2418
{
@@ -211,6 +205,5 @@ public void WeakEventManagerAction_RemoveventHandler_WhiteSpaceEventName()
211205
Assert.Throws<ArgumentNullException>(() => _actionEventManager.RemoveEventHandler(null, " "), "Value cannot be null.\nParameter name: eventName");
212206
#pragma warning enable CS8625
213207
}
214-
#endregion
215208
}
216209
}

Src/AsyncAwaitBestPractices.UnitTests/WeakEventManager/Tests_WeakEventManager_ActionT.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,14 @@ namespace AsyncAwaitBestPractices.UnitTests
55
{
66
class Tests_WeakEventManager_ActionT : BaseTest
77
{
8-
#region Constant Fields
98
readonly WeakEventManager<string> _actionEventManager = new WeakEventManager<string>();
10-
#endregion
119

12-
#region Events
1310
public event Action<string> ActionEvent
1411
{
1512
add => _actionEventManager.AddEventHandler(value);
1613
remove => _actionEventManager.RemoveEventHandler(value);
1714
}
18-
#endregion
1915

20-
#region Methods
2116
[Test]
2217
public void WeakEventManagerActionT_HandleEvent_ValidImplementation()
2318
{
@@ -237,6 +232,5 @@ public void WeakEventManagerActionT_RemoveventHandler_WhiteSpaceEventName()
237232
Assert.Throws<ArgumentNullException>(() => _actionEventManager.RemoveEventHandler(s => { var temp = s; }, " "), "Value cannot be null.\nParameter name: eventName");
238233
#pragma warning enable CS8625
239234
}
240-
#endregion
241235
}
242236
}

Src/AsyncAwaitBestPractices.UnitTests/WeakEventManager/Tests_WeakEventManager_Delegate.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,14 @@ namespace AsyncAwaitBestPractices.UnitTests
66
{
77
class Tests_WeakEventManager_Delegate : BaseTest, INotifyPropertyChanged
88
{
9-
#region Constant Fields
109
readonly WeakEventManager _propertyChangedWeakEventManager = new WeakEventManager();
11-
#endregion
1210

13-
#region Events
1411
public event PropertyChangedEventHandler PropertyChanged
1512
{
1613
add => _propertyChangedWeakEventManager.AddEventHandler(value);
1714
remove => _propertyChangedWeakEventManager.RemoveEventHandler(value);
1815
}
19-
#endregion
2016

21-
#region Methods
2217
[Test]
2318
public void WeakEventManagerDelegate_HandleEvent_ValidImplementation()
2419
{
@@ -285,6 +280,5 @@ public void WeakEventManagerDelegate_RemoveventHandler_WhiteSpaceEventName()
285280
Assert.Throws<ArgumentNullException>(() => _propertyChangedWeakEventManager.RemoveEventHandler(null, " "), "Value cannot be null.\nParameter name: eventName");
286281
#pragma warning enable CS8625
287282
}
288-
#endregion
289283
}
290284
}

Src/HackNews.Droid/HackerNews.Droid.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
</ItemGroup>
6363
<ItemGroup>
6464
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
65-
<PackageReference Include="Xamarin.Forms" Version="4.2.0.618605-pre2" />
65+
<PackageReference Include="Xamarin.Forms" Version="4.2.0.673161-pre3" />
6666
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.3" />
6767
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.5.2" />
6868
<PackageReference Include="Xamarin.Essentials" Version="1.2.0" />

Src/HackerNews.UITests/HackerNews.UITests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
</ItemGroup>
3333
<ItemGroup>
3434
<PackageReference Include="NUnit" Version="3.12.0" />
35-
<PackageReference Include="Xamarin.UITest" Version="3.0.2" />
35+
<PackageReference Include="Xamarin.UITest" Version="3.0.3" />
3636
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
3737
</ItemGroup>
3838
<ItemGroup>

Src/HackerNews.UITests/Pages/BasePage.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,16 @@ namespace HackerNews.UITests
44
{
55
public abstract class BasePage
66
{
7-
#region Constructors
87
protected BasePage(IApp app, string pageTitle)
98
{
109
App = app;
1110
PageTitle = pageTitle;
1211
}
13-
#endregion
1412

15-
#region Properties
1613
public string PageTitle { get; }
1714
protected IApp App { get; }
18-
#endregion
1915

20-
#region Methods
2116
public virtual void WaitForPageToLoad() => App.WaitForElement(x => x.Marked(PageTitle));
22-
#endregion
2317
}
2418
}
2519

Src/HackerNews.UITests/Tests/BaseTest.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,13 @@ namespace HackerNews.UITests
88
[TestFixture(Platform.iOS)]
99
public abstract class BaseTest
1010
{
11-
#region Constant Fields
1211
readonly Platform _platform;
13-
#endregion
1412

15-
#region Constructors
1613
protected BaseTest(Platform platform) => _platform = platform;
17-
#endregion
1814

19-
#region Properties
2015
protected IApp App { get; private set; }
2116
protected NewsPage NewsPage { get; private set; }
22-
#endregion
2317

24-
#region Methods
2518
[SetUp]
2619
public virtual void BeforeEachTest()
2720
{
@@ -32,7 +25,10 @@ public virtual void BeforeEachTest()
3225

3326
NewsPage.WaitForPageToLoad();
3427
}
35-
#endregion
28+
29+
[Test]
30+
[Ignore("Only used for testing")]
31+
public void ReplTest() => App.Repl();
3632
}
3733
}
3834

0 commit comments

Comments
 (0)