-
Notifications
You must be signed in to change notification settings - Fork 467
Expand file tree
/
Copy pathCommandCheckerTests.cs
More file actions
34 lines (30 loc) · 1.29 KB
/
CommandCheckerTests.cs
File metadata and controls
34 lines (30 loc) · 1.29 KB
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
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System.Runtime.InteropServices;
using Azure.Functions.Cli.Common;
using FluentAssertions;
using Xunit;
namespace Azure.Functions.Cli.UnitTests
{
public class CommandCheckerTests
{
[Fact]
public void CommandCheckerShouldWork()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
var exists = CommandChecker.CommandExists("cmd");
var doesntExist = CommandChecker.CommandExists("fooo");
exists.Should().BeTrue(because: "checking if cmd command exists should always be true on Windows");
doesntExist.Should().BeFalse(because: "checking if fooo command exists on windows should be false");
}
else
{
var exists = CommandChecker.CommandExists("bash");
var doesntExist = CommandChecker.CommandExists("fooo");
exists.Should().BeTrue(because: "checking if sh command exists should always be true on Unix-like");
doesntExist.Should().BeFalse(because: "checking if fooo command exists on Unix-like should be false");
}
}
}
}