public void TokenProviderCanBeDisabled()
        {
            using (var ctx = TestCommon.CreateClientContext())
            {
                var _mockProvider = new Provider
                {
                    Assembly = "OfficeDevPnP.Core.Tests",
                    Type = "OfficeDevPnP.Core.Tests.Framework.ExtensibilityCallOut.ExtensibilityMockTokenProvider",
                    Configuration = ExtensibilityTestConstants.PROVIDER_MOCK_DATA,
                    Enabled = false
                };               

                var _mockTemplate = new ProvisioningTemplate();
                _mockTemplate.Id = ExtensibilityTestConstants.PROVISIONINGTEMPLATE_ID;
                _mockTemplate.Providers.Add(_mockProvider);

                var extensibilityHandler = new ObjectExtensibilityProviders();
                var parser = new TokenParser(ctx.Web, _mockTemplate);
                extensibilityHandler.AddExtendedTokens(ctx.Web, _mockTemplate, parser, null);

                var parsedValue = parser.ParseString(MockToken.MockTokenKey);
                Assert.AreEqual(MockToken.MockTokenKey, parsedValue, "Disabled tokenprovider should not have provided tokens!");
            }
        }
        public void TokenProviderReceivesExpectedParameters()
        {
            var givenConfiguration = "START {parameter:MOCKPARAM} END";
            var expectedConfiguration = "START MOCKPARAMVALUE END";

            using (var ctx = TestCommon.CreateClientContext())
            {
                var _mockProvider = new Provider
                {
                    Assembly = "OfficeDevPnP.Core.Tests",
                    Type = "OfficeDevPnP.Core.Tests.Framework.ExtensibilityCallOut.ExtensibilityMockTokenProvider",
                    Configuration = givenConfiguration,
                    Enabled = true
                };

                var _mockTemplate = new ProvisioningTemplate();
                _mockTemplate.Parameters.Add("MOCKPARAM", "MOCKPARAMVALUE");
                _mockTemplate.Id = ExtensibilityTestConstants.PROVISIONINGTEMPLATE_ID;
                _mockTemplate.Providers.Add(_mockProvider);

                var extensibilityHandler = new ObjectExtensibilityProviders();
                var parser = new TokenParser(ctx.Web, _mockTemplate);
                extensibilityHandler.AddExtendedTokens(ctx.Web, _mockTemplate, parser, null);

                Assert.AreSame(ctx, ExtensibilityMockTokenProvider.ReceivedCtx, "Wrong clientContext passed to the provider.");
                Assert.AreSame(_mockTemplate, ExtensibilityMockTokenProvider.ReceivedProvisioningTemplate, "Wrong template passed to the provider.");
                Assert.AreEqual(expectedConfiguration, ExtensibilityMockTokenProvider.ReceivedConfigurationData, "Wrong configuration data passed to the provider.");
            }
        }