private Loop(NameDefinition label, IExpression preCondition, IEnumerable <IExpression> body, IEnumerable <IExpression> postStep, IExpression postCondition) { // each iteration is: // pre-condition // body // step // post-condition this.Label = label; this.preCondition = preCondition; this.PostStep = (postStep ?? Enumerable.Empty <IExpression>()).StoreReadOnly(); this.Body = (body ?? Enumerable.Empty <IExpression>()).StoreReadOnly(); this.postCondition = postCondition; this.ReadMode = ExpressionReadMode.CannotBeRead; // todo: temporary state this.attachPostConstructor(); this.flow = Later.Create(() => ExecutionFlow.CreateLoop(PreCondition, thenPath: Body, postMaybes: PostStep.Concat(PostCondition))); }
public void RunShouldCallXdtTransform(IXdtTransformEngine xdt, IFilePathResolver path) { var postStep = new PostStep(xdt, path); //act postStep.Run(null, null); xdt.Received(1).ApplyConfigTransformation(Arg.Any <string>(), Arg.Any <string>(), Arg.Any <string>()); }
public void RunShouldNotCallXdtTransformIfTransformFileIsMissing(IXdtTransformEngine xdt, IFilePathResolver path) { path.MapPath(Arg.Any <string>()).Returns((string)null); var postStep = new PostStep(xdt, path); //act postStep.Run(null, null); xdt.DidNotReceive().ApplyConfigTransformation(Arg.Any <string>(), Arg.Any <string>(), Arg.Any <string>()); }
public void RunShouldCallXdtTransform(IXdtTransformEngine xdt, IFilePathResolver path, ITransformsProvider transform) { var postStep = new PostStep(xdt, path, transform); transform.GetTransformsByLayer(Arg.Any<string>()).Returns(new List<string>() {"web.config.transform"}); //act postStep.Run(null, null); xdt.Received().ApplyConfigTransformation(Arg.Any<string>(), Arg.Any<string>(), Arg.Any<string>()); }
public void RunShouldNotCallXdtTransformIfTransformFileIsMissing(IXdtTransformEngine xdt, IFilePathResolver path) { path.MapPath(Arg.Any<string>()).Returns((string)null); var postStep = new PostStep(xdt, path); //act postStep.Run(null, null); xdt.DidNotReceive().ApplyConfigTransformation(Arg.Any<string>(), Arg.Any<string>(), Arg.Any<string>()); }
public void RunShouldCallXdtTransform(IXdtTransformEngine xdt, IFilePathResolver path) { var postStep = new PostStep(xdt, path); //act postStep.Run(null, null); xdt.Received(1).ApplyConfigTransformation(Arg.Any<string>(), Arg.Any<string>(), Arg.Any<string>()); }
public void Run_NotExistingType_LogError(MemoryAppender appender, PostStep postStep) { //Arrange BasicConfigurator.Configure(appender); var nameValueCollection = new NameValueCollection(); nameValueCollection.Add("Attributes", "NotExistingType"); //Act postStep.Run(null, nameValueCollection); //Assert appender.Events.Should().Contain(x => x.Level == Level.ERROR && x.RenderedMessage.Contains("NotExistingType")); }
public void Run_TwoCorrectPostStepAction_CallBothPostSteps(PostStep postStep) { //Arrange FakePostStepAction.CallCount = 0; var nameValueCollection = new NameValueCollection(); nameValueCollection.Add("Attributes", "name1=Sitecore.Foundation.Installer.Tests.PostStepTests+FakePostStepAction, Sitecore.Foundation.Installer.Tests|name2=Sitecore.Foundation.Installer.Tests.PostStepTests+FakePostStepAction, Sitecore.Foundation.Installer.Tests|"); //Act postStep.Run(null, nameValueCollection); //Assert FakePostStepAction.CallCount.Should().Be(2); }
public void RunShouldCallXdtTransform(IXdtTransformEngine xdt, IFilePathResolver path, ITransformsProvider transform) { var postStep = new PostStep(xdt, path, transform); transform.GetTransformsByLayer(Arg.Any <string>()).Returns(new List <string>() { "web.config.transform" }); //act postStep.Run(null, null); xdt.Received().ApplyConfigTransformation(Arg.Any <string>(), Arg.Any <string>(), Arg.Any <string>()); }
internal void RaiseWorldPostStep(float timestep) { PostStep?.Invoke(timestep); }