Beispiel #1
0
        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>());
        }
Beispiel #2
0
        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>());
        }
Beispiel #3
0
    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>());
    }
Beispiel #4
0
    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>());
    }
Beispiel #5
0
    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>());
    }
Beispiel #6
0
    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"));
    }
Beispiel #7
0
    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);
    }
Beispiel #8
0
        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>());
        }
Beispiel #9
0
        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"));
        }
Beispiel #10
0
        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);
        }