public void IsScriptRegisteredTest()
        {
            var targetType = typeof(AccordionExtender);

            _mockScriptManagerConfig.Setup(
                c => c.GetControlTypesInBundles(It.IsAny <HttpContextBase>(), It.IsAny <string[]>()))
            .Returns(new List <Type>()
            {
                targetType
            });

            var scriptCombiner = new ToolkitScriptManagerCombiner(_mockScriptManagerConfig.Object,
                                                                  _mockToolkitScriptManagerHelper.Object);

            // Call GetScriptReferences so script references are registered
            scriptCombiner.LoadScriptReferences(null, null);

            // Get one of script reference as a test data
            var reference = ScriptObjectBuilder.GetScriptReferences(targetType).First();

            // Assertion
            var result =
                scriptCombiner.IsScriptRegistered(new ScriptReference()
            {
                Assembly = reference.Assembly,
                Name     = reference.Name
            });

            Assert.AreEqual(true, result);
        }
        public void GetCombinedScriptContentHashTest()
        {
            var scriptCombiner = new ToolkitScriptManagerCombiner(_mockScriptManagerConfig.Object, _mockToolkitScriptManagerHelper.Object);
            var targetType     = typeof(AccordionExtender);

            _mockScriptManagerConfig.Setup(
                c => c.GetControlTypesInBundles(It.IsAny <HttpContextBase>(), It.IsAny <string[]>()))
            .Returns(new List <Type>()
            {
                targetType
            });

            _mockToolkitScriptManagerHelper.Setup(h => h.Hashing(It.IsAny <string>()))
            .Returns((string content) =>
            {
                if (string.IsNullOrEmpty(content))
                {
                    return("empty-hash");
                }
                return("hashed");
            });

            scriptCombiner.LoadScriptReferences(_moqContext.Object, null);
            var result = scriptCombiner.GetCombinedScriptContentHash(null, null, false);

            Assert.AreEqual("hashed", result);
        }
        public void IsScriptRegisteredWithNoScriptEntriesTest()
        {
            var scriptCombiner = new ToolkitScriptManagerCombiner(_mockScriptManagerConfig.Object, _mockToolkitScriptManagerHelper.Object);

            // Pretend no control is registered, thus no script reference that registered
            _mockScriptManagerConfig.Setup(
                c => c.GetControlTypesInBundles(It.IsAny <HttpContextBase>(), It.IsAny <string[]>()))
            .Returns(new List <Type>()
            {
            });

            // Call GetScriptReferences so script references are registered
            scriptCombiner.LoadScriptReferences(null, null);

            // Assertion
            var result = scriptCombiner.IsScriptRegistered(new ScriptReference());

            Assert.AreEqual(false, result);
        }