Exemple #1
0
        protected void MockGitLocationForConfiguration()
        {
            var globalConfiguration = Mocks.DynamicMock <GlobalConfiguration>();

            globalConfiguration.Expect(v => v.GitExecutableLocation).Return(GitInstallLocation);

            ConfigurationSettings.Global = globalConfiguration;

            Mocks.ReplayAll();
        }
        private CloneView SetUpClonePresenterTestWithRepositry(string repositoryToClone, string expectedDestinationFolder)
        {
            var cloneView = Mocks.DynamicMock <CloneView>();

            cloneView.Expect(v => v.RepositoryToClone).Return(repositoryToClone);

            cloneView.DestinationFolder = expectedDestinationFolder;
            LastCall.PropertyBehavior();

            Mocks.ReplayAll();

            return(cloneView);
        }
        public void LogManager_InjectionTest()
        {
            ILogFactory factory = Mocks.CreateMock <ILogFactory>();

            Expect.Call(factory.GetLogger(GetType())).Return(Mocks.DynamicMock <ILog>());
            ReplayAll();

            LogManager.LogFactory = factory;
            ILog log = LogManager.GetLogger(GetType());

            Assert.IsNotNull(log);
            VerifyAll();
        }
        public void WhenTextIsAddedToRepositoryDisplayDestionationIsCalled()
        {
            var view = Mocks.DynamicMock <CloneView>();

            view.Expect(v => v.DisplayDestinationFolder());

            view.RepositoryToClone = "ve";
            LastCall.PropertyBehavior();

            Mocks.ReplayAll();

            view.RepositoryToClone = "somedata";

            var presenter = new ClonePresenter(view);

            presenter.RepositoryToCloneChanged();

            Assert.That(presenter.DestinationFolderDisplayed, Is.True);
        }
        public void IfDestinationFolderBlankItIsNotSet()
        {
            var cloneView = Mocks.DynamicMock <CloneView>();

            cloneView.Expect(v => v.RepositoryToClone).IgnoreArguments().Repeat.Never();

            cloneView.DestinationFolder = null;
            LastCall.PropertyBehavior();
            LastCall.IgnoreArguments();
            LastCall.Repeat.Never();

            Mocks.ReplayAll();

            var presenter = new ClonePresenter(cloneView);

            presenter.SetDestinationFolder(null);

            Assert.That(cloneView.DestinationFolder, Is.Null);
        }
        public void WhenTextIsRemovedToRepositoryHideDisplayIsCalled()
        {
            var view = Mocks.DynamicMock <CloneView>();

            view.Expect(v => v.HideDestinationFolder());

            view.RepositoryToClone = "ve";
            LastCall.PropertyBehavior();

            Mocks.ReplayAll();

            view.RepositoryToClone = "some early data";

            var presenter = new ClonePresenter(view);

            presenter.RepositoryToCloneChanged();

            view.RepositoryToClone = null;

            presenter.RepositoryToCloneChanged();

            Assert.That(presenter.DestinationFolderDisplayed, Is.False);
        }