Skip to content
Open
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
9 changes: 1 addition & 8 deletions LibGit2Sharp.Tests/EqualityFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,9 @@ public void EqualityHelperCanTestNullInHashCode()

private class ObjectWithEquality : GitObject
{
private readonly ObjectId id;

public ObjectWithEquality(ObjectId id = null)
: base(null, id)
{
this.id = id;
}

public override ObjectId Id
{
get { return id; }
}
}
}
Expand Down
4 changes: 0 additions & 4 deletions LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Reference Include="Moq, Version=4.2.1507.118, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.2.1507.0118\lib\net40\Moq.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml" />
Expand Down Expand Up @@ -89,7 +86,6 @@
<Compile Include="CleanFixture.cs" />
<Compile Include="CurrentOperationFixture.cs" />
<Compile Include="MetaFixture.cs" />
<Compile Include="MockingFixture.cs" />
<Compile Include="ConfigurationFixture.cs" />
<Compile Include="AttributesFixture.cs" />
<Compile Include="CommitAncestorFixture.cs" />
Expand Down
73 changes: 0 additions & 73 deletions LibGit2Sharp.Tests/MetaFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
using LibGit2Sharp.Tests.TestHelpers;
using Xunit;
using Xunit.Extensions;
using Moq;

namespace LibGit2Sharp.Tests
{
Expand Down Expand Up @@ -83,78 +82,6 @@ public void TypesInLibGit2DecoratedWithDebuggerDisplayMustFollowTheStandardImplP
}
}

// Related to https://github.com/libgit2/libgit2sharp/pull/185
[Fact]
public void TypesInLibGit2SharpMustBeExtensibleInATestingContext()
{
var nonTestableTypes = new Dictionary<Type, IEnumerable<string>>();

IEnumerable<Type> libGit2SharpTypes = Assembly.GetAssembly(typeof(IRepository)).GetExportedTypes()
.Where(t => MustBeMockable(t) && t.Namespace == typeof(IRepository).Namespace);

foreach (Type type in libGit2SharpTypes)
{
if (type.IsInterface || type.IsEnum || IsStatic(type))
continue;

var nonVirtualMethodNamesForType = GetNonVirtualPublicMethodsNames(type).ToList();
if (nonVirtualMethodNamesForType.Any())
{
nonTestableTypes.Add(type, nonVirtualMethodNamesForType);
continue;
}

if (!HasEmptyPublicOrProtectedConstructor(type))
{
nonTestableTypes.Add(type, new List<string>());
}

if (type.IsAbstract)
{
continue;
}

try
{
if (type.ContainsGenericParameters)
{
var constructType = type.MakeGenericType(Enumerable.Repeat(typeof(object), type.GetGenericArguments().Length).ToArray());
Activator.CreateInstance(constructType, true);
}
else
{
Activator.CreateInstance(type, true);
}
}
catch
{
nonTestableTypes.Add(type, new List<string>());
}
}

if (nonTestableTypes.Any())
{
Assert.True(false, Environment.NewLine + BuildNonTestableTypesMessage(nonTestableTypes));
}
}

private static bool MustBeMockable(Type type)
{
if (type.IsSealed)
{
return false;
}

if (type.IsAbstract)
{
return !type.Assembly.GetExportedTypes()
.Where(t => t.IsSubclassOf(type))
.All(t => t.IsAbstract || t.IsSealed);
}

return true;
}

[Fact]
public void LibGit2SharpPublicInterfacesCoverAllPublicMembers()
{
Expand Down
110 changes: 0 additions & 110 deletions LibGit2Sharp.Tests/MockingFixture.cs

This file was deleted.

1 change: 0 additions & 1 deletion LibGit2Sharp.Tests/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Moq" version="4.2.1507.0118" targetFramework="net40" />
<package id="xunit" version="1.9.2" targetFramework="net40" />
<package id="xunit.extensions" version="1.9.2" targetFramework="net40" />
<package id="xunit.runner.visualstudio" version="2.1.0" targetFramework="net40" />
Expand Down
6 changes: 0 additions & 6 deletions LibGit2Sharp/AfterRebaseStepInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@
/// </summary>
public class AfterRebaseStepInfo
{
/// <summary>
/// Needed for mocking.
/// </summary>
protected AfterRebaseStepInfo()
{ }

internal AfterRebaseStepInfo(RebaseStepInfo stepInfo, Commit commit, long completedStepIndex, long totalStepCount)
{
StepInfo = stepInfo;
Expand Down
6 changes: 0 additions & 6 deletions LibGit2Sharp/BeforeRebaseStepInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ namespace LibGit2Sharp
/// </summary>
public class BeforeRebaseStepInfo
{
/// <summary>
/// Needed for mocking.
/// </summary>
protected BeforeRebaseStepInfo()
{ }

internal BeforeRebaseStepInfo(RebaseStepInfo stepInfo, long stepIndex, long totalStepCount)
{
StepInfo = stepInfo;
Expand Down
6 changes: 0 additions & 6 deletions LibGit2Sharp/BlameHunk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,6 @@ internal BlameHunk(IRepository repository, GitBlameHunk rawHunk)
}
}

/// <summary>
/// For easier mocking
/// </summary>
protected BlameHunk()
{ }

/// <summary>
/// Determine if this hunk contains a given line.
/// </summary>
Expand Down
5 changes: 0 additions & 5 deletions LibGit2Sharp/BlameHunkCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ public class BlameHunkCollection : IEnumerable<BlameHunk>
private readonly IRepository repo;
private readonly List<BlameHunk> hunks = new List<BlameHunk>();

/// <summary>
/// For easy mocking
/// </summary>
protected BlameHunkCollection() { }

internal BlameHunkCollection(Repository repo, RepositorySafeHandle repoHandle, string path, BlameOptions options)
{
this.repo = repo;
Expand Down
6 changes: 0 additions & 6 deletions LibGit2Sharp/Blob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ public class Blob : GitObject
private readonly ILazy<Int64> lazySize;
private readonly ILazy<bool> lazyIsBinary;

/// <summary>
/// Needed for mocking purposes.
/// </summary>
protected Blob()
{ }

internal Blob(Repository repo, ObjectId id)
: base(repo, id)
{
Expand Down
6 changes: 0 additions & 6 deletions LibGit2Sharp/Branch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ public class Branch : ReferenceWrapper<Commit>
{
private readonly Lazy<Branch> trackedBranch;

/// <summary>
/// Needed for mocking purposes.
/// </summary>
protected Branch()
{ }

/// <summary>
/// Initializes a new instance of the <see cref="Branch"/> class.
/// </summary>
Expand Down
6 changes: 0 additions & 6 deletions LibGit2Sharp/BranchCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ public class BranchCollection : IEnumerable<Branch>
{
internal readonly Repository repo;

/// <summary>
/// Needed for mocking purposes.
/// </summary>
protected BranchCollection()
{ }

/// <summary>
/// Initializes a new instance of the <see cref="BranchCollection"/> class.
/// </summary>
Expand Down
6 changes: 0 additions & 6 deletions LibGit2Sharp/BranchTrackingDetails.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ public class BranchTrackingDetails
{
private readonly HistoryDivergence historyDivergence;

/// <summary>
/// Needed for mocking purposes.
/// </summary>
protected BranchTrackingDetails()
{ }

internal BranchTrackingDetails(Repository repo, Branch branch)
{
if (!branch.IsTracking || branch.Tip == null || branch.TrackedBranch.Tip == null)
Expand Down
6 changes: 0 additions & 6 deletions LibGit2Sharp/BranchUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ public class BranchUpdater
private readonly Repository repo;
private readonly Branch branch;

/// <summary>
/// Needed for mocking purposes.
/// </summary>
protected BranchUpdater()
{ }

internal BranchUpdater(Repository repo, Branch branch)
{
Ensure.ArgumentNotNull(repo, "repo");
Expand Down
6 changes: 0 additions & 6 deletions LibGit2Sharp/CertificateSsh.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ namespace LibGit2Sharp
/// </summary>
public class CertificateSsh : Certificate
{
/// <summary>
/// For mocking purposes
/// </summary>
protected CertificateSsh()
{ }

/// <summary>
/// The MD5 hash of the host. Meaningful if <see cref="HasMD5"/> is true
/// </summary>
Expand Down
7 changes: 0 additions & 7 deletions LibGit2Sharp/CertificateX509.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@ namespace LibGit2Sharp
/// </summary>
public class CertificateX509 : Certificate
{

/// <summary>
/// For mocking purposes
/// </summary>
protected CertificateX509()
{ }

/// <summary>
/// The certificate.
/// </summary>
Expand Down
Loading