Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
zentron committed Sep 12, 2024
1 parent 7b407f5 commit ac25679
Showing 1 changed file with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Calamari.Deployment;
using Calamari.Deployment.Conventions;
using Calamari.Integration.Iis;
using FluentAssertions;
using NSubstitute;
using NUnit.Framework;

Expand Down Expand Up @@ -61,19 +62,37 @@ public void ShouldUsePackageNameIfWebsiteNameVariableNotSupplied()
}

[Test]
public void ShouldForceIis6CompatibilityIfFlagSet()
public void ShouldForceIis6CompatibilityIfSuperForceFlagSet()
{
const string websiteName = "AcmeOnline";
variables.Set(SpecialVariables.Package.UpdateIisWebsite, true.ToString());
variables.Set(SpecialVariables.Package.UpdateIisWebsiteName, websiteName);
variables.Set(SpecialVariables.UseLegacyIisSupport, true.ToString());
variables.Set(SpecialVariables.UseLegacyIisSupportForce, true.ToString());
fileSystem.FileExists(Path.Combine(stagingDirectory, "Web.config")).Returns(true);
iis.OverwriteHomeDirectory(websiteName, stagingDirectory, true).Returns(true);

CreateConvention().Install(deployment);

iis.Received().OverwriteHomeDirectory(websiteName, stagingDirectory, true);
}

public void ShouldFailIis6CompatibilityIfFlagSet()
{
const string websiteName = "AcmeOnline";
variables.Set(SpecialVariables.Package.UpdateIisWebsite, true.ToString());
variables.Set(SpecialVariables.Package.UpdateIisWebsiteName, websiteName);
variables.Set(SpecialVariables.UseLegacyIisSupport, true.ToString());
fileSystem.FileExists(Path.Combine(stagingDirectory, "Web.config")).Returns(true);
iis.OverwriteHomeDirectory(websiteName, stagingDirectory, true).Returns(true);

var exception = Assert.Throws<CommandException>(() =>
CreateConvention().Install(deployment)
);
exception.Message.Should().Contain("Support for IIS6 is no longer supported.");

iis.DidNotReceive().OverwriteHomeDirectory(websiteName, stagingDirectory, true);
}

[Test]
public void ShouldNotUpdatePathIfFlagNotSet()
Expand Down

0 comments on commit ac25679

Please sign in to comment.