public void VisitDebugConfig() { //Init args DebugConfig debugConfig = new DebugConfig() { IfStart = true }; //Expectations List <string> expectedArgs = new List <string>() { "s3://elasticmapreduce/libs/state-pusher/0.1/fetch" }; //Init visitor BuildRequestVisitor visitor = new BuildRequestVisitor(BuildRequestVisitorTest.GetSettings()); VisitorSubscriber visitorSubscriber = new VisitorSubscriber(visitor); //Action debugConfig.Accept(visitor); //Verify Assert.AreEqual(1, visitorSubscriber.TotalObjCount, "Unexpected number of objects created"); StepConfig actual = visitorSubscriber.stepList[0]; Assert.AreEqual("Start debugging", actual.Name, "Unexpected Name"); Assert.AreEqual(ActionOnFailure.CONTINUE, actual.ActionOnFailure, "Unexpected ActionOnFailure"); Assert.AreEqual("s3://elasticmapreduce/libs/script-runner/script-runner.jar", actual.HadoopJarStep.Jar, "Unexpected Jar"); Assert.IsNull(actual.HadoopJarStep.MainClass, "Unexpected MainClass"); Assert.IsTrue(expectedArgs.SequenceEqual(actual.HadoopJarStep.Args), "Unexpected args list"); }
public void SkipDebugConfigIfStartFalse() { //Init args DebugConfig debugConfig = new DebugConfig(); //Init visitor BuildRequestVisitor visitor = new BuildRequestVisitor(BuildRequestVisitorTest.GetSettings()); VisitorSubscriber visitorSubscriber = new VisitorSubscriber(visitor); //Action debugConfig.Accept(visitor); //Verify Assert.IsFalse(visitorSubscriber.wasAnyEventFired, "None of the visitor's events should be fired!"); }