forked from GitTools/GitVersion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathArgumentParserOnBuildServerTests.cs
45 lines (36 loc) · 1.46 KB
/
ArgumentParserOnBuildServerTests.cs
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
41
42
43
44
45
using GitVersion.Agents;
using GitVersion.Core.Tests.Helpers;
using GitVersion.OutputVariables;
using Microsoft.Extensions.DependencyInjection;
namespace GitVersion.App.Tests;
[TestFixture]
public class ArgumentParserOnBuildServerTests : TestBase
{
private IArgumentParser argumentParser;
[SetUp]
public void SetUp()
{
var sp = ConfigureServices(services =>
{
services.AddSingleton<IArgumentParser, ArgumentParser>();
services.AddSingleton<IGlobbingResolver, GlobbingResolver>();
services.AddSingleton<ICurrentBuildAgent, MockBuildAgent>();
});
this.argumentParser = sp.GetRequiredService<IArgumentParser>();
}
[Test]
public void EmptyOnFetchDisabledBuildServerMeansNoFetchIsTrue()
{
var arguments = this.argumentParser.ParseArguments("");
arguments.NoFetch.ShouldBe(true);
}
private class MockBuildAgent : ICurrentBuildAgent
{
public bool IsDefault => false;
public bool CanApplyToCurrentContext() => throw new NotImplementedException();
public void WriteIntegration(Action<string> writer, GitVersionVariables variables, bool updateBuildNumber = true) => throw new NotImplementedException();
public string GetCurrentBranch(bool usingDynamicRepos) => throw new NotImplementedException();
public bool PreventFetch() => true;
public bool ShouldCleanUpRemotes() => throw new NotImplementedException();
}
}