@@ -14,6 +14,7 @@ namespace GitVersionExe.Tests
14
14
[ TestFixture ]
15
15
public class ArgumentParserTests : TestBase
16
16
{
17
+ private IEnvironment environment ;
17
18
private IArgumentParser argumentParser ;
18
19
19
20
[ SetUp ]
@@ -24,6 +25,7 @@ public void SetUp()
24
25
services . AddSingleton < IArgumentParser , ArgumentParser > ( ) ;
25
26
services . AddSingleton < IGlobbingResolver , GlobbingResolver > ( ) ;
26
27
} ) ;
28
+ environment = sp . GetService < IEnvironment > ( ) ;
27
29
argumentParser = sp . GetService < IArgumentParser > ( ) ;
28
30
}
29
31
@@ -604,5 +606,37 @@ public void CheckVerbosityParsing(string command, bool shouldThrow, Verbosity ex
604
606
arguments . Verbosity . ShouldBe ( expectedVerbosity ) ;
605
607
}
606
608
}
609
+
610
+ [ Test ]
611
+ public void EmptyArgumentsRemoteUsernameDefinedSetsUsername ( )
612
+ {
613
+ environment . SetEnvironmentVariable ( "GITVERSION_REMOTE_USERNAME" , "value" ) ;
614
+ var arguments = argumentParser . ParseArguments ( string . Empty ) ;
615
+ arguments . Authentication . Username . ShouldBe ( "value" ) ;
616
+ }
617
+
618
+ [ Test ]
619
+ public void EmptyArgumentsRemotePasswordDefinedSetsPassword ( )
620
+ {
621
+ environment . SetEnvironmentVariable ( "GITVERSION_REMOTE_PASSWORD" , "value" ) ;
622
+ var arguments = argumentParser . ParseArguments ( string . Empty ) ;
623
+ arguments . Authentication . Password . ShouldBe ( "value" ) ;
624
+ }
625
+
626
+ [ Test ]
627
+ public void ArbitraryArgumentsRemoteUsernameDefinedSetsUsername ( )
628
+ {
629
+ environment . SetEnvironmentVariable ( "GITVERSION_REMOTE_USERNAME" , "value" ) ;
630
+ var arguments = argumentParser . ParseArguments ( "-nocache" ) ;
631
+ arguments . Authentication . Username . ShouldBe ( "value" ) ;
632
+ }
633
+
634
+ [ Test ]
635
+ public void ArbitraryArgumentsRemotePasswordDefinedSetsPassword ( )
636
+ {
637
+ environment . SetEnvironmentVariable ( "GITVERSION_REMOTE_PASSWORD" , "value" ) ;
638
+ var arguments = argumentParser . ParseArguments ( "-nocache" ) ;
639
+ arguments . Authentication . Password . ShouldBe ( "value" ) ;
640
+ }
607
641
}
608
642
}
0 commit comments