Skip to content
This repository has been archived by the owner on Jan 6, 2021. It is now read-only.

GitTools/GitTools.Testing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Icon

GitTools.Testing

Makes it easy to automate git for testing libraries which interact with git. This library was pulled out of GitVersion so it could be used in other projects.

License Version Pre-release version Build status Build Status

Fixtures

The main purpose for this library, providing test fixtures which wrap a temporary git repository making it super easy to create test scenarios. For example

using (var fixture = new GitTools.Testing.EmptyRepositoryFixture())
{
    fixture.MakeACommit();
    fixture.MakeACommit();
    fixture.MakeATaggedCommit("1.0.0");
    fixture.BranchTo("develop");
    fixture.MakeACommit();
    fixture.Checkout("master");
    fixture.MergeNoFF("develop");
}

Other fixtures:

  • LocalRepositoryFixture
  • RemoteRepositoryFixture - Creates a remote repository (locally) then clones it giving you access to both to simulate remote repositories.
  • BaseGitFlowRepository - Repository setup for gitflow with develop already checked out

Sequence diagrams

For each of the methods on the fixture, the same extension methods exist on IRepository, the difference is that any methods called on the fixture will automatically record that action in a sequence diagram.

When you dispose the fixture it will automatically log to LibLog a PlantUML Sequence Diagram, which you can paste into a tool like CodeUML, SeedUML or PlantText to render.

The above test produces

@startuml
master -> master: commit
master -> master: commit
master -> master: commit
master -> master: tag 1.0.0
create participant develop
master -> develop: branch from master
develop -> develop: commit
develop -> master: merge
@enduml

Paste that into one of the tools above to see the result!

Other API's

Generate - Makes it easy to generate fake signatures VirtualTime - When testing git you can do lots of operations during the same second, this messes git up. VirtualTime increments the time by a minute each time you access .Now

And a number of other libgit2sharp extension methods which make the api simpler for your tests.

Icon

Network by Lorena Salagre from the Noun Project

About

Makes working with test git repositories super easy!

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages