Beispiel #1
0
        public void VisitProject_ShouldReturn_Success()
        {
            var instance = new NullVisitor();
            var code     = instance.VisitProject(null, Lib1Config);

            Assert.AreEqual(ReturnCode.Success, code, "Invalid ReturnCode");
        }
Beispiel #2
0
        public void VisitDependency_ShouldReturn_Success()
        {
            var instance = new NullVisitor();
            var code     = instance.VisitDependency(null, Lib1Dependency);

            Assert.AreEqual(ReturnCode.Success, code, "Invalid ReturnCode");
        }
        /// <summary>
        /// 確認所有條件是有任一為null
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="root"></param>
        /// <param name="getter"></param>
        /// <returns></returns>
        public static bool IsNull <T>(this T root, Expression <Func <T, object> > getter)
        {
            var visitor = new NullVisitor()
            {
                CurrentObject = root
            };

            visitor.Visit(getter);
            return(visitor.IsNull);
        }
Beispiel #4
0
        /// <summary>
        /// Executes the command.
        /// </summary>
        /// <returns>The return code.</returns>
        public ReturnCode Execute()
        {
            IVisitor visitor = new NullVisitor();

            _algorithm.TraverseDependencies(visitor, _options.Directory);

            if (visitor.ReturnCode == ReturnCode.Success)
            {
                _console.WriteLine("Successfully cloned all dependencies");
            }

            visitor = new CheckOutDependencyBranchVisitor();
            _algorithm.Reset();
            _algorithm.TraverseDependencies(visitor, _options.Directory);

            if (visitor.ReturnCode == ReturnCode.Success)
            {
                _console.WriteLine("All dependencies on the correct branch");
            }

            return(visitor.ReturnCode);
        }