public void DoesNotThrowWhenDynamicAssemblyIsLoaded()
        {
            var parameters = new CompilerParameters { GenerateExecutable = false, OutputAssembly = "autogen.dll" };
            var dynamicAssembly = CodeDomProvider.CreateProvider("CSharp").CompileAssemblyFromSource(parameters, "public class B { public static int k=7; }");

            var b = AppDomain.CurrentDomain.CreateInstanceFromAndUnwrap(dynamicAssembly.PathToAssembly, "B");

            var scriptManager = new ManifestResourceScriptManager();
            var x = scriptManager.GetSqlScripts("test");
        }
        public void CanGetScripts()
        {
            // arrange
            var scriptManager = new ManifestResourceScriptManager();

            // act
            var scripts = scriptManager.GetSqlScripts("a");

            // assert
            scripts.Should().HaveCount(2);
        }
        public void CanThrowMissingScriptException()
        {
            // arrange
            var scriptManager = new ManifestResourceScriptManager();
            var message = "message";

            // act
            Action action = () => scriptManager.ThrowMissingScriptException(message);

            // assert
            action.ShouldThrow<MissingManifestResourceException>().WithMessage(message);
        }
Пример #4
0
        public void CanReferenceDuplicateScript()
        {
            // arrange
            Support.Ensure.Loaded(); // NOTE (Cameron): This ensures that the assembly is loaded which affect the script manager (pre bug fix).
            var scriptManager = new ManifestResourceScriptManager();

            // act
            var scripts = scriptManager.GetSqlScripts("Duplicate");

            // assert
            Assert.True(scripts.Count() == 1);
        }