public void CreatesNewPSResourceGroupWithUserTemplate()
        {
            CreatePSResourceGroupParameters expectedParameters = new CreatePSResourceGroupParameters()
            {
                ResourceGroupName = resourceGroupName,
                Location = resourceGroupLocation,
                TemplateFile = templateFile,
                DeploymentName = deploymentName,
                StorageAccountName = storageAccountName,
                TemplateVersion = "1.0"
            };
            CreatePSResourceGroupParameters actualParameters = new CreatePSResourceGroupParameters();
            PSResourceGroup expected = new PSResourceGroup()
            {
                Location = expectedParameters.Location,
                ResourceGroupName = expectedParameters.ResourceGroupName,
                Resources = new List<PSResource>() { new PSResource() { Name = "resource1" } }
            };
            resourcesClientMock.Setup(f => f.CreatePSResourceGroup(It.IsAny<CreatePSResourceGroupParameters>()))
                .Returns(expected)
                .Callback((CreatePSResourceGroupParameters p) => { actualParameters = p; });

            cmdlet.Name = expectedParameters.ResourceGroupName;
            cmdlet.Location = expectedParameters.Location;
            cmdlet.TemplateFile = expectedParameters.TemplateFile;
            cmdlet.DeploymentName = expectedParameters.DeploymentName;
            cmdlet.TemplateVersion = expectedParameters.TemplateVersion;

            cmdlet.ExecuteCmdlet();

            Assert.Equal(expectedParameters.ResourceGroupName, actualParameters.ResourceGroupName);
            Assert.Equal(expectedParameters.Location, actualParameters.Location);
            Assert.Equal(expectedParameters.DeploymentName, actualParameters.DeploymentName);
            Assert.Equal(expectedParameters.GalleryTemplateIdentity, actualParameters.GalleryTemplateIdentity);
            Assert.Equal(expectedParameters.TemplateFile, actualParameters.TemplateFile);
            Assert.NotNull(actualParameters.TemplateParameterObject);
            Assert.Equal(expectedParameters.TemplateVersion, actualParameters.TemplateVersion);
            Assert.Equal(null, actualParameters.StorageAccountName);

            commandRuntimeMock.Verify(f => f.WriteObject(expected), Times.Once());
        }
        public void GetsResourcesGroups()
        {
            List<PSResourceGroup> result = new List<PSResourceGroup>();
            PSResourceGroup expected = new PSResourceGroup()
            {
                Location = resourceGroupLocation,
                ResourceGroupName = resourceGroupName,
                Resources = new List<PSResource>() { new PSResource() { Name = "resource1" } }
            };
            result.Add(expected);
            resourcesClientMock.Setup(f => f.FilterResourceGroups(resourceGroupName)).Returns(result);

            cmdlet.Name = resourceGroupName;

            cmdlet.ExecuteCmdlet();

            Assert.Equal(1, result.Count);
            Assert.Equal(resourceGroupName, result[0].ResourceGroupName);
            Assert.Equal(resourceGroupLocation, result[0].Location);
            Assert.Equal(1, result[0].Resources.Count);

            commandRuntimeMock.Verify(f => f.WriteObject(result, true), Times.Once());
        }