Files
git-tfs/GitTfsTest/Commands/ExtTest.cs
Philippe Miossec f75b7ca5be Remove unallowed chars in labels
TFS permit chars that are not allowed in Git tag name (for exemple space)
2012-12-20 14:06:07 +01:00

48 lines
1.8 KiB
C#

using System;
using System.Collections.Generic;
using System.IO;
using Rhino.Mocks;
using Sep.Git.Tfs.Commands;
using Sep.Git.Tfs.Core;
using Sep.Git.Tfs.Core.TfsInterop;
using StructureMap.AutoMocking;
using Xunit;
using Sep.Git.Tfs.Util;
namespace Sep.Git.Tfs.Test.Commands
{
public class ExtTest
{
[Fact]
public void AssertValidTfsPathTest()
{
Assert.DoesNotThrow(() => "$/test".AssertValidTfsPath());
Assert.Throws(typeof(GitTfsException), () => "$test".AssertValidTfsPath());
Assert.Throws(typeof(GitTfsException), () => "/test".AssertValidTfsPath());
Assert.Throws(typeof(GitTfsException), () => "test".AssertValidTfsPath());
}
[Fact]
public void ToGitRefNameTest()
{
Assert.Equal("test", "test".ToGitRefName());
Assert.Equal("test", "te^st".ToGitRefName());
Assert.Equal("test", "te~st".ToGitRefName());
Assert.Equal("test", "te st".ToGitRefName());
Assert.Equal("test", "te:st".ToGitRefName());
Assert.Equal("test", "te*st".ToGitRefName());
Assert.Equal("test", "te?st".ToGitRefName());
Assert.Equal("test", "te[st".ToGitRefName());
Assert.Equal("test", "test/".ToGitRefName());
Assert.Equal("test", "test.".ToGitRefName());
Assert.Equal("test", "te..st".ToGitRefName());
Assert.Equal("test", "test.".ToGitRefName());
Assert.Equal("test", "te\\st.".ToGitRefName());
Assert.Equal("test", "te@{st.".ToGitRefName());
Assert.Equal("test", "/test././".ToGitRefName());
Assert.Equal("bugs/nameOfTheBug", "/bu$gs/name:OfTheBug".ToGitRefName());
Assert.Equal("repo/test/test2", "$/repo/te:st/test2".ToGitRefName());
}
}
}