public override IEnumerable<object[]> GetData(MethodInfo methodUnderTest, Type[] parameterTypes)
        {
            var makefiles = Directory.GetFiles(Directory.GetCurrentDirectory(), "test-*.shade").Select(Path.GetFileName);
            var settings = new SakeSettings { Output = Console.Out };
            var loader = new DefaultLoader(new DefaultLog(settings), settings);
            foreach (var makefile in makefiles)
            {
                IBuilder builder;
                try
                {
                    builder = loader.Load(new Options { Makefile = makefile });
                }
                catch (Exception)
                {
                    builder = null;
                }

                if (builder == null)
                {
                    yield return new object[] { makefile, null };
                }
                else
                {
                    foreach (var target in builder.Targets.Values.Where(target => target.Name.StartsWith("test-")))
                    {
                        yield return new object[] { makefile, target.Name };
                    }
                }
            }
        }
示例#2
0
 public void MakefileTarget(string makefile, string target)
 {
     var settings = new SakeSettings { Output = new RemoveEscapes(Console.Out) };
     var loader = new DefaultLoader(new DefaultLog(settings), settings);
     var engine = new SakeEngine(settings, loader, new DefaultRunner());
     engine.Execute(new Options { Makefile = makefile, Targets = new[] { target } });
 }
示例#3
0
文件: Program.cs 项目: plurby/sake
        static void Main(string[] args)
        {
            var settings = new SakeSettings
            {
                Output = new ConsoleWriter()
            };

            using (var container = CreateContainer(settings))
            {
                var engine = container.Resolve<SakeEngine>();
                try
                {
                    engine.Execute(args);
                }
                catch (Exception ex)
                {
                    container.Resolve<ILog>().Warn(ex.Message + Environment.NewLine + ex.StackTrace);
                }
            }
        }