Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions debian/tests/TestProject/Main.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Google.Apis;

namespace TestProject
{
class Program
{
static void Main(string[] args)
{
Stack<int> myStack = new Stack<int>();
var th = new Thread(()=>WaitAndPrint(myStack));
th.Start();
Console.WriteLine("Me first!");
myStack.Push(1);
Console.WriteLine("Finished tasks: {0}", myStack.Count);
Thread.Sleep(1000);
Console.WriteLine("Finished tasks: {0}", myStack.Count);
}

private static void WaitAndPrint(Stack<int> myStack){
Thread.Sleep(1000);
Console.WriteLine("Me second!");
myStack.Push(2);
}
}
}
10 changes: 10 additions & 0 deletions debian/tests/TestProject/TestProject.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
3 changes: 2 additions & 1 deletion debian/tests/basic-checks
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ BINARY="/usr/bin/dotnet"
echo "Checking binary is present and its usefulness"
test -e "${BINARY}"
dotnet --version
dotnet --info
dotnet --info
dotnet sdk check
11 changes: 10 additions & 1 deletion debian/tests/basic-commands
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,13 @@ set -eo pipefail

dotnet new console --name TestConsole
cd TestConsole
dotnet run | grep -qF "Hello, World!"
dotnet new sln
dotnet sln TestConsole.sln add TestConsole.csproj
dotnet build TestConsole.sln
cd bin/Debug/net6.0/
output=$(./TestConsole)
if [ "$output" != "Hello, World!" ]; then
echo 'Test did not output "Hello, World!"'
exit 1
fi
cd ..
4 changes: 4 additions & 0 deletions debian/tests/control
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Tests: basic-checks basic-commands
Depends: @
Restrictions: superficial

Tests: csproj-with-nuget
Depends: @
Restrictions: superficial isolation-container needs-internet
17 changes: 17 additions & 0 deletions debian/tests/csproj-with-nuget
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

##################################
### Check basic nuget commands ###
##################################

set -eo pipefail

cd "$(dirname "${0}")"/TestProject
dotnet add TestProject.csproj package Google.Apis
output=$(dotnet run | wc -l)
if [ "$output" != "4" ]; then
echo 'Test project did not work'
exit 1
fi
dotnet remove TestProject.csproj package Google.Apis
cd ..