예제 #1
0
        public void Execute_ShouldReturn_InvalidArguments_WhenNoBranchNameIsPresent()
        {
            var options  = new CheckOutSubOptions();
            var instance = new CheckOutCommand(options);
            var code     = instance.Execute();

            Assert.AreEqual(ReturnCode.InvalidArguments, code, "Invalid Return Code");
        }
예제 #2
0
        public void Execute_ShouldReturn_Error_WhenTraverseDependencies_Fails()
        {
            const string BRANCH_NAME = "feature/testing_2";

            var algorithm = Container.Resolve <IDependencyVisitorAlgorithm>();

            algorithm.Arrange(a => a.TraverseDependencies(Arg.IsAny <IVisitor>(), Arg.AnyString))
            .DoInstead((IVisitor visitor, string directory) =>
            {
                visitor.ReturnCode = ReturnCode.FailedToRunGitCommand;
            })
            .MustBeCalled();

            var options = new CheckOutSubOptions
            {
                BranchName = BRANCH_NAME
            };
            var instance = new CheckOutCommand(options);
            var code     = instance.Execute();

            algorithm.Assert();
            Assert.AreEqual(ReturnCode.FailedToRunGitCommand, code, "Invalid Return Code");
        }