|
31 | 31 | using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Formatters;
|
32 | 32 | using Newtonsoft.Json.Linq;
|
33 | 33 | using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Extensions;
|
| 34 | +using FluentAssertions; |
34 | 35 |
|
35 | 36 | namespace Microsoft.Azure.Commands.Resources.Test.Resources
|
36 | 37 | {
|
@@ -147,5 +148,36 @@ public void ValidatesPSResourceGroupDeploymentWithUserTemplateWithDiagnostics()
|
147 | 148 | commandRuntimeMock.Verify(f => f.WriteObject(expectedObject, true), Times.Once());
|
148 | 149 | commandRuntimeMock.Verify(f => f.WriteObject(It.IsAny<List<PSResourceManagerError>>()), Times.Never());
|
149 | 150 | }
|
| 151 | + |
| 152 | + [Fact] |
| 153 | + [Trait(Category.AcceptanceType, Category.CheckIn)] |
| 154 | + public void ValidatesPSResourceGroupDeploymentWithUserTemplateProviderNoRbac() |
| 155 | + { |
| 156 | + PSDeploymentCmdletParameters expectedParameters = new PSDeploymentCmdletParameters() |
| 157 | + { |
| 158 | + TemplateFile = templateFile, |
| 159 | + ValidationLevel = ValidationLevel.ProviderNoRbac |
| 160 | + }; |
| 161 | + PSDeploymentCmdletParameters actualParameters = new PSDeploymentCmdletParameters(); |
| 162 | + |
| 163 | + TemplateValidationInfo expectedResults = new(new DeploymentValidateResult()); |
| 164 | + |
| 165 | + resourcesClientMock.Setup(f => f.ValidateDeployment( |
| 166 | + It.IsAny<PSDeploymentCmdletParameters>())) |
| 167 | + .Returns(expectedResults) |
| 168 | + .Callback((PSDeploymentCmdletParameters p) => { actualParameters = p; }); |
| 169 | + |
| 170 | + cmdlet.ResourceGroupName = resourceGroupName; |
| 171 | + cmdlet.TemplateFile = expectedParameters.TemplateFile; |
| 172 | + cmdlet.ValidationLevel = ValidationLevel.ProviderNoRbac; |
| 173 | + |
| 174 | + cmdlet.ExecuteCmdlet(); |
| 175 | + |
| 176 | + actualParameters.TemplateFile.Should().Equals(expectedParameters.TemplateFile); |
| 177 | + |
| 178 | + actualParameters.ValidationLevel.Should().Be(ValidationLevel.ProviderNoRbac); |
| 179 | + |
| 180 | + Assert.NotNull(actualParameters.TemplateParameterObject); |
| 181 | + } |
150 | 182 | }
|
151 | 183 | }
|
0 commit comments