Created unit tests for the --autocrlf option to init and clone.
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
using System.IO;
|
||||
using Sep.Git.Tfs.Commands;
|
||||
using StructureMap.AutoMocking;
|
||||
using NDesk.Options;
|
||||
using Xunit;
|
||||
|
||||
namespace Sep.Git.Tfs.Test.Commands
|
||||
{
|
||||
public class InitOptionsTest
|
||||
{
|
||||
private RhinoAutoMocker<InitOptions> mocks;
|
||||
|
||||
public InitOptionsTest()
|
||||
{
|
||||
mocks = new RhinoAutoMocker<InitOptions>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AutoCrlfDefault()
|
||||
{
|
||||
Assert.Equal("false", mocks.ClassUnderTest.GitInitAutoCrlf);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AutoCrlfProvideTrue()
|
||||
{
|
||||
string[] args = {"init", "--autocrlf=true", "http://example.com/tfs", "$/Junk"};
|
||||
mocks.ClassUnderTest.OptionSet.Parse(args);
|
||||
Assert.Equal("true", mocks.ClassUnderTest.GitInitAutoCrlf);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AutoCrlfProvideFalse()
|
||||
{
|
||||
string[] args = { "init", "--autocrlf=false", "http://example.com/tfs", "$/Junk" };
|
||||
mocks.ClassUnderTest.OptionSet.Parse(args);
|
||||
Assert.Equal("false", mocks.ClassUnderTest.GitInitAutoCrlf);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AutoCrlfProvideAuto()
|
||||
{
|
||||
string[] args = { "init", "--autocrlf=auto", "http://example.com/tfs", "$/Junk" };
|
||||
mocks.ClassUnderTest.OptionSet.Parse(args);
|
||||
Assert.Equal("auto", mocks.ClassUnderTest.GitInitAutoCrlf);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AutoCrlfProvideInvalidOption()
|
||||
{
|
||||
string[] args = { "init", "--autocrlf=windows", "http://example.com/tfs", "$/Junk" };
|
||||
Assert.Throws<OptionException>(() => mocks.ClassUnderTest.OptionSet.Parse(args));
|
||||
Assert.Equal("false", mocks.ClassUnderTest.GitInitAutoCrlf);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -85,6 +85,7 @@
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Commands\InitOptionsTest.cs" />
|
||||
<Compile Include="FactExceptOnUnix.cs" />
|
||||
<Compile Include="Commands\HelpTest.cs" />
|
||||
<Compile Include="Commands\ShelveTest.cs" />
|
||||
@@ -152,4 +153,4 @@
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user