コード例 #1
0
        public void ExtenstionConfig_SetToAnInvalidValue_Throws(string hostJsonContent)
        {
            File.WriteAllText(_hostJsonFile, hostJsonContent);
            Assert.True(File.Exists(_hostJsonFile));
            var configuration = BuildHostJsonConfiguration();

            ExtensionBundleOptionsSetup setup   = new ExtensionBundleOptionsSetup(configuration);
            ExtensionBundleOptions      options = new ExtensionBundleOptions();
            var ex = Assert.Throws <ArgumentException>(() => setup.Configure(options));

            Assert.StartsWith($"The value of id property in extensionBundle section of {ScriptConstants.HostMetadataFileName} file is invalid or missing.", ex.Message);
        }
コード例 #2
0
        public void MissingOrValidExtenstionConfig_DoesNotThrowException(string hostJsonContent)
        {
            File.WriteAllText(_hostJsonFile, hostJsonContent);
            Assert.True(File.Exists(_hostJsonFile));
            var configuration = BuildHostJsonConfiguration();

            ExtensionBundleOptionsSetup setup   = new ExtensionBundleOptionsSetup(configuration);
            ExtensionBundleOptions      options = new ExtensionBundleOptions();
            var ex = Record.Exception(() => setup.Configure(options));

            Assert.Null(ex);
        }