Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions LibGit2Sharp.Tests/MetaFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,25 @@ public void TypesInLibGit2SharpMustBeExtensibleInATestingContext()
}
}

[Fact]
public void EnumsWithFlagsHaveMutuallyExclusiveValues()
{
var flagsEnums = Assembly.GetAssembly(typeof(Repository)).GetExportedTypes()
.Where(t => t.IsEnum && t.GetCustomAttributes(typeof(FlagsAttribute), false).Any());

var overlaps = from t in flagsEnums
from int x in Enum.GetValues(t)
where x != 0
from int y in Enum.GetValues(t)
where y != 0
where x != y && (x & y) == y
select string.Format("{0}.{1} overlaps with {0}.{2}", t.Name, Enum.ToObject(t, x), Enum.ToObject(t, y));

var message = string.Join(Environment.NewLine, overlaps.ToArray());

Assert.Equal("", message);
}

private string BuildMissingDebuggerDisplayPropertyMessage(IEnumerable<Type> typesWithDebuggerDisplayAndInvalidImplPattern)
{
var sb = new StringBuilder();
Expand Down
15 changes: 0 additions & 15 deletions LibGit2Sharp.Tests/StatusFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,6 @@ namespace LibGit2Sharp.Tests
{
public class StatusFixture : BaseFixture
{
[Fact]
public void FileStatusFlagsAreMutuallyExclusive()
{
var overlaps = from FileStatus x in Enum.GetValues(typeof(FileStatus))
where x != default(FileStatus)
from FileStatus y in Enum.GetValues(typeof(FileStatus))
where y != default(FileStatus)
where x != y && (x & y) == y
select string.Format("{0} overlaps with {1}", x, y);

var message = string.Join(Environment.NewLine, overlaps.ToArray());

Assert.Equal("", message);
}

[Fact]
public void CanRetrieveTheStatusOfAFile()
{
Expand Down