Skip to content

Commit

Permalink
Add a completion callback
Browse files Browse the repository at this point in the history
  • Loading branch information
nirinchev committed Apr 17, 2017
1 parent 1d6e96f commit cb14194
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 38 deletions.
2 changes: 1 addition & 1 deletion src/runner/nunit.runner.iOS/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"dependencies": {
"NUnit": "3.6.1",
"PCLStorage": "1.0.2",
"Xamarin.Forms": "2.3.3.193"
"Xamarin.Forms": "2.3.4.224"
},
"frameworks": {
"xamarinios10": {}
Expand Down
6 changes: 6 additions & 0 deletions src/runner/nunit.runner/Services/TestOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************

using System;
using PCLStorage;

namespace NUnit.Runner.Services
Expand Down Expand Up @@ -51,6 +52,11 @@ public TestOptions()
/// </summary>
public bool TerminateAfterExecution { get; set; }

/// <summary>
/// Gets or sets the callback that will be called after running the tests.
/// </summary>
public Action OnCompletedCallback { get; set; }

/// <summary>
/// Information about the tcp listener host and port.
/// For now, send result as XML to the listening server.
Expand Down
2 changes: 1 addition & 1 deletion src/runner/nunit.runner/View/ExploreView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
BackgroundColor="{DynamicResource defaultBackground}"
Title="{Binding Title}">
<ContentPage.Content>
<Grid>
<Grid Style="{DynamicResource defaultBackground}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
Expand Down
63 changes: 29 additions & 34 deletions src/runner/nunit.runner/View/ResultsView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,34 @@
Title="Test Results"
Padding="0"
BackgroundColor="{DynamicResource defaultBackground}" >
<StackLayout Orientation="Vertical" Spacing="4" BackgroundColor="{DynamicResource defaultBackground}" >
<ScrollView Orientation="Vertical"
VerticalOptions="FillAndExpand"
HorizontalOptions="FillAndExpand" >
<ListView ItemsSource="{Binding Results}"
ItemSelected="ViewTest"
VerticalOptions="FillAndExpand"
HorizontalOptions="FillAndExpand"
HasUnevenRows="true">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<ListView ItemsSource="{Binding Results}"
ItemSelected="ViewTest"
VerticalOptions="FillAndExpand"
HorizontalOptions="FillAndExpand"
HasUnevenRows="true"
Style="{DynamicResource defaultBackground}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>

<Grid.ColumnDefinitions>
<ColumnDefinition Width="10" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>

<BoxView Color="{Binding Color}" Grid.RowSpan="2" />
<Label Text="{Binding Name}" FontSize="Medium" Grid.Column="1" />
<Label Text="{Binding Parent}" TextColor="#4C4C4C" LineBreakMode="MiddleTruncation" FontSize="Small" Grid.Row="1" Grid.Column="1"/>
</Grid>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</ScrollView>
</StackLayout>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>

<BoxView Color="{Binding Color}" Grid.RowSpan="2" />
<Label Text="{Binding Name}" FontSize="Medium" Grid.Column="1" />
<Label Text="{Binding Parent}" TextColor="#4C4C4C" LineBreakMode="MiddleTruncation" FontSize="Small" Grid.Row="1" Grid.Column="1"/>
</Grid>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</ContentPage>
2 changes: 2 additions & 0 deletions src/runner/nunit.runner/ViewModel/SummaryViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ private async Task ExecuteTestsAync()

Device.BeginInvokeOnMainThread(() =>
{
Options.OnCompletedCallback?.Invoke();

if (Options.TerminateAfterExecution)
{
TerminateWithSuccess();
Expand Down
4 changes: 2 additions & 2 deletions src/tests/nunit.runner.tests.Droid/project.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"dependencies": {
"NUnit": "3.6.1",
"Xamarin.Forms": "1.5.0.6447"
"Xamarin.Forms": "2.3.4.224"
},
"frameworks": {
"monoandroid60": {}
"monoandroid71": {}
},
"runtimes": {
"win": {}
Expand Down

0 comments on commit cb14194

Please sign in to comment.