summaryrefslogtreecommitdiffstats
path: root/nixos/tests/windmill/csharp.script
blob: ec37677aec3f6a843e063e5aed37b5ad8257671d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// WARN; Cannot download dependency modules from internet during sandbox testing!

using System;
using System.Linq;

class Script
{
    public static int Main(string[] extraWords, string word = "clue", int highNumberThreshold = 50)
    {
        Console.WriteLine("Hello, World!");

        Console.WriteLine("Your chosen words are:");

        string[] newWordArray = extraWords.Concat(new[] { word }).ToArray();

        foreach (var s in newWordArray)
        {
            Console.WriteLine($"  {s}");
        }

        var random = new Random();
        int randomNumber = random.Next(1, 101);

        Console.WriteLine($"Random number: {randomNumber}");

        string greeting = randomNumber > highNumberThreshold ? "High number!" : "Low number!";
        greeting += " (according to the threshold parameter)";
        Console.WriteLine(greeting);

        var timespan = TimeSpan.FromMinutes(90);
        Console.WriteLine($"Timespan: {timespan}");

        int number = 123;
        Console.WriteLine($"Number: {number}");

        var date = DateTime.UtcNow.AddDays(-3);
        Console.WriteLine($"Date: {date}");
        return 2;
    }
}