public void SetupMocks() { _viewMock = new Mock<IChangesView>(); _providerMock = new Mock<ISourceControlProvider>(); var branch = new Branch("master", "refs/Heads/master", false, true); _providerMock.SetupGet(git => git.CurrentBranch).Returns(branch); }
public void IntializeFixtures() { _provider = new Mock<ISourceControlProvider>(); _view = new Mock<IBranchesView>(); _createView = new Mock<ICreateBranchView>(); _deleteView = new Mock<IDeleteBranchView>(); _mergeView = new Mock<IMergeView>(); _intialBranch = new Branch("master", "refs/Heads/master", false, true); //todo: create more realistic list of branches. Include `HEAD` so that we can ensure it gets excluded. _branches = new List<IBranch>() { _intialBranch, new Branch("dev", "ref/Heads/dev",isRemote: false, isCurrentHead:false), new Branch("origin/master", "refs/remotes/origin/master", true, true), new Branch("origin/HEAD", "refs/remotes/origin/HEAD", true, false) }; _provider.SetupGet(git => git.Branches).Returns(_branches); _provider.SetupGet(git => git.CurrentBranch).Returns(_intialBranch); _presenter = new BranchesPresenter(_view.Object, _createView.Object, _deleteView.Object, _mergeView.Object, _provider.Object); }
public void InitializeMocks() { _window = Mocks.MockFactory.CreateWindowMock(); _windows = new MockWindowsCollection(new List<Window> { _window.Object }); _vbe = Mocks.MockFactory.CreateVbeMock(_windows); _configService = new Mock<IConfigurationService<SourceControlConfiguration>>(); _configService.Setup(c => c.LoadConfiguration()).Returns(GetDummyConfig()); _folderBrowser = new Mock<IFolderBrowser>(); _folderBrowserFactory = new Mock<IFolderBrowserFactory>(); _folderBrowserFactory.Setup(f => f.CreateFolderBrowser(It.IsAny<string>())).Returns(_folderBrowser.Object); _folderBrowserFactory.Setup(f => f.CreateFolderBrowser(It.IsAny<string>(), false)).Returns(_folderBrowser.Object); var masterRemote = new Mock<LibGit2Sharp.Branch>(); masterRemote.SetupGet(git => git.Tip).Returns(new Mock<LibGit2Sharp.Commit>().Object); masterRemote.SetupGet(git => git.FriendlyName).Returns("master"); var initialBranch = new Branch("master", "refs/Heads/master", false, true, masterRemote.Object); _provider = new Mock<ISourceControlProvider>(); _provider.SetupGet(git => git.CurrentBranch).Returns(initialBranch); _provider.SetupGet(git => git.UnsyncedLocalCommits).Returns(new List<ICommit>()); _provider.SetupGet(git => git.UnsyncedRemoteCommits).Returns(new List<ICommit>()); _provider.Setup(git => git.InitVBAProject(It.IsAny<string>())).Returns(GetDummyRepo()); _provider.Setup(git => git.Clone(It.IsAny<string>(), It.IsAny<string>())).Returns(GetDummyRepo()); _providerFactory = new Mock<ISourceControlProviderFactory>(); _providerFactory.Setup(f => f.CreateProvider(It.IsAny<VBProject>())) .Returns(_provider.Object); _providerFactory.Setup(f => f.CreateProvider(It.IsAny<VBProject>(), It.IsAny<IRepository>(), It.IsAny<ICodePaneWrapperFactory>())) .Returns(_provider.Object); _providerFactory.Setup(f => f.CreateProvider(It.IsAny<VBProject>(), It.IsAny<IRepository>(), It.IsAny<SecureCredentials>(), It.IsAny<ICodePaneWrapperFactory>())) .Returns(_provider.Object); _changesVM = new ChangesViewViewModel(); _branchesVM = new BranchesViewViewModel(); _unsyncedVM = new UnsyncedCommitsViewViewModel(); _settingsVM = new SettingsViewViewModel(_configService.Object, _folderBrowserFactory.Object); }
public void IntializeFixtures() { _provider = new Mock<ISourceControlProvider>(); var masterRemote = new Mock<LibGit2Sharp.Branch>(); masterRemote.SetupGet(git => git.Tip).Returns(new Mock<LibGit2Sharp.Commit>().Object); masterRemote.SetupGet(git => git.FriendlyName).Returns("master"); _intialBranch = new Branch("master", "refs/Heads/master", false, true, masterRemote.Object); //todo: create more realistic list of branches. Include `HEAD` so that we can ensure it gets excluded. _branches = new List<IBranch> { _intialBranch, new Branch("dev", "ref/Heads/dev", false, false, null), new Branch("origin/master", "refs/remotes/origin/master", true, true, null), new Branch("origin/HEAD", "refs/remotes/origin/HEAD", true, false, null) }; _provider.SetupGet(git => git.Branches).Returns(_branches); _provider.SetupGet(git => git.CurrentBranch).Returns(_intialBranch); }