예제 #1
0
        public void KeyFile()
        {
            var t = new ResolveComReference.AxImp();

            t.ActiveXControlName = "FakeControl.ocx";
            string badParameterValue  = "myKeyFile.key";
            string goodParameterValue = null;

            try
            {
                goodParameterValue = FileUtilities.GetTemporaryFile();
                t.ToolPath         = Path.GetTempPath();

                Assert.Null(t.KeyFile); // "KeyFile should be null by default"
                CommandLine.ValidateNoParameterStartsWith(t, @"/keyfile:", false /* no response file */);

                t.KeyFile = badParameterValue;
                Assert.Equal(badParameterValue, t.KeyFile); // "New KeyFile value should be set"
                CommandLine.ValidateHasParameter(t, @"/keyfile:" + badParameterValue, false /* no response file */);
                Utilities.ExecuteTaskAndVerifyLogContainsErrorFromResource(t, "AxTlbBaseTask.InvalidKeyFileSpecified", t.KeyFile);

                t.KeyFile = goodParameterValue;
                Assert.Equal(goodParameterValue, t.KeyFile); // "New KeyFile value should be set"
                CommandLine.ValidateHasParameter(t, @"/keyfile:" + goodParameterValue, false /* no response file */);
                Utilities.ExecuteTaskAndVerifyLogContainsErrorFromResource(t, "AxTlbBaseTask.StrongNameUtils.NoKeyPairInFile", t.KeyFile);
            }
            finally
            {
                if (goodParameterValue != null)
                {
                    // get rid of the generated temp file
                    File.Delete(goodParameterValue);
                }
            }
        }
예제 #2
0
        public void ToolPath()
        {
            var t = new ResolveComReference.AxImp();

            t.ActiveXControlName = "FakeControl.ocx";
            string badParameterValue  = @"C:\Program Files\Microsoft Visual Studio 10.0\My Fake SDK Path";
            string goodParameterValue = Path.GetTempPath();
            bool   taskPassed;

            Assert.Null(t.ToolPath); // "ToolPath should be null by default"
            Utilities.ExecuteTaskAndVerifyLogContainsErrorFromResource(t, "AxTlbBaseTask.SdkOrToolPathNotSpecifiedOrInvalid", t.SdkToolsPath, t.ToolPath);

            t.ToolPath = badParameterValue;
            Assert.Equal(badParameterValue, t.ToolPath); // "New ToolPath value should be set"
            Utilities.ExecuteTaskAndVerifyLogContainsErrorFromResource(t, "AxTlbBaseTask.SdkOrToolPathNotSpecifiedOrInvalid", t.SdkToolsPath, t.ToolPath);

            MockEngine e = new MockEngine();

            t.BuildEngine = e;
            t.ToolPath    = goodParameterValue;

            Assert.Equal(goodParameterValue, t.ToolPath); // "New ToolPath value should be set"
            taskPassed = t.Execute();
            Assert.False(taskPassed);                     // "Task should still fail -- there are other things wrong with it."

            // but that particular error shouldn't be there anymore.
            string toolPathMessage = t.Log.FormatResourceString("AxTlbBaseTask.SdkOrToolPathNotSpecifiedOrInvalid", t.SdkToolsPath, t.ToolPath);
            string messageWithNoCode;
            string toolPathCode = t.Log.ExtractMessageCode(toolPathMessage, out messageWithNoCode);

            e.AssertLogDoesntContain(toolPathCode);
        }
예제 #3
0
        public void NoLogo()
        {
            var t = new ResolveComReference.AxImp();

            Assert.IsFalse(t.NoLogo, "NoLogo should be false by default");
            CommandLine.ValidateNoParameterStartsWith(t, @"/nologo", false /* no response file */);

            t.NoLogo = true;
            Assert.IsTrue(t.NoLogo, "NoLogo should be true");
            CommandLine.ValidateHasParameter(t, @"/nologo", false /* no response file */);
        }
예제 #4
0
        public void GenerateSource()
        {
            var t = new ResolveComReference.AxImp();

            Assert.IsFalse(t.GenerateSource, "GenerateSource should be false by default");
            CommandLine.ValidateNoParameterStartsWith(t, @"/source", false /* no response file */);

            t.GenerateSource = true;
            Assert.IsTrue(t.GenerateSource, "GenerateSource should be true");
            CommandLine.ValidateHasParameter(t, @"/source", false /* no response file */);
        }
예제 #5
0
        public void ActiveXControlNameWithSpaces()
        {
            var    t = new ResolveComReference.AxImp();
            string testParameterValue = @"c:\Program Files\AxInterop.Foo.dll";

            Assert.IsNull(t.ActiveXControlName, "ActiveXControlName should be null by default");

            t.ActiveXControlName = testParameterValue;
            Assert.AreEqual(testParameterValue, t.ActiveXControlName, "New ActiveXControlName value should be set");
            CommandLine.ValidateHasParameter(t, testParameterValue, false /* no response file */);
        }
예제 #6
0
        public void Silent()
        {
            var t = new ResolveComReference.AxImp();

            Assert.IsFalse(t.Silent, "Silent should be false by default");
            CommandLine.ValidateNoParameterStartsWith(t, @"/silent", false /* no response file */);

            t.Silent = true;
            Assert.IsTrue(t.Silent, "Silent should be true");
            CommandLine.ValidateHasParameter(t, @"/silent", false /* no response file */);
        }
예제 #7
0
파일: AxImp_Tests.cs 프로젝트: 3F/IeXod
        public void ActiveXControlName()
        {
            var    t = new ResolveComReference.AxImp();
            string testParameterValue = "AxInterop.Foo.dll";

            Assert.Null(t.ActiveXControlName); // "ActiveXControlName should be null by default"

            t.ActiveXControlName = testParameterValue;
            Assert.Equal(testParameterValue, t.ActiveXControlName); // "New ActiveXControlName value should be set"
            CommandLine.ValidateHasParameter(t, testParameterValue, false /* no response file */);
        }
예제 #8
0
        public void DelaySign()
        {
            AxTlbBaseTask t = new ResolveComReference.AxImp();

            Assert.False(t.DelaySign); // "DelaySign should be false by default"
            CommandLine.ValidateNoParameterStartsWith(t, @"/delaysign", false /* no response file */);

            t.DelaySign = true;
            Assert.True(t.DelaySign); // "DelaySign should be true"
            CommandLine.ValidateHasParameter(t, @"/delaysign", false /* no response file */);
        }
예제 #9
0
        public void Verbose()
        {
            var t = new ResolveComReference.AxImp();

            Assert.False(t.Verbose); // "Verbose should be false by default"
            CommandLine.ValidateNoParameterStartsWith(t, @"/verbose", false /* no response file */);

            t.Verbose = true;
            Assert.True(t.Verbose); // "Verbose should be true"
            CommandLine.ValidateHasParameter(t, @"/verbose", false /* no response file */);
        }
예제 #10
0
        public void OutputAssembly()
        {
            var    t = new ResolveComReference.AxImp();
            string testParameterValue = "AxInterop.Foo.dll";

            Assert.IsNull(t.OutputAssembly, "OutputAssembly should be null by default");
            CommandLine.ValidateNoParameterStartsWith(t, @"/out:", false /* no response file */);

            t.OutputAssembly = testParameterValue;
            Assert.AreEqual(testParameterValue, t.OutputAssembly, "New OutputAssembly value should be set");
            CommandLine.ValidateHasParameter(t, @"/out:" + testParameterValue, false /* no response file */);
        }
예제 #11
0
        public void RuntimeCallableWrapperWithSpaces()
        {
            var    t = new ResolveComReference.AxImp();
            string testParameterValue = @"C:\Program Files\Microsoft Visual Studio 10.0\Interop.Foo.dll";

            Assert.IsNull(t.RuntimeCallableWrapperAssembly, "RuntimeCallableWrapper should be null by default");
            CommandLine.ValidateNoParameterStartsWith(t, @"/rcw:", false /* no response file */);

            t.RuntimeCallableWrapperAssembly = testParameterValue;
            Assert.AreEqual(testParameterValue, t.RuntimeCallableWrapperAssembly, "New RuntimeCallableWrapper value should be set");
            CommandLine.ValidateHasParameter(t, @"/rcw:" + testParameterValue, false /* no response file */);
        }
예제 #12
0
        public void KeyContainerWithSpaces()
        {
            AxTlbBaseTask t = new ResolveComReference.AxImp();
            string        testParameterValue = @"my Key Container";

            Assert.Null(t.KeyContainer); // "KeyContainer should be null by default"
            CommandLine.ValidateNoParameterStartsWith(t, @"/keycontainer:", false /* no response file */);

            t.KeyContainer = testParameterValue;
            Assert.Equal(testParameterValue, t.KeyContainer); // "New KeyContainer value should be set"
            CommandLine.ValidateHasParameter(t, @"/keycontainer:" + testParameterValue, false /* no response file */);
        }
예제 #13
0
        public void RuntimeCallableWrapper()
        {
            var    t = new ResolveComReference.AxImp();
            string testParameterValue = "Interop.Foo.dll";

            Assert.Null(t.RuntimeCallableWrapperAssembly); // "RuntimeCallableWrapper should be null by default"
            CommandLine.ValidateNoParameterStartsWith(t, @"/rcw:", false /* no response file */);

            t.RuntimeCallableWrapperAssembly = testParameterValue;
            Assert.Equal(testParameterValue, t.RuntimeCallableWrapperAssembly); // "New RuntimeCallableWrapper value should be set"
            CommandLine.ValidateHasParameter(t, @"/rcw:" + testParameterValue, false /* no response file */);
        }
예제 #14
0
        public void OutputAssemblyWithSpaces()
        {
            var    t = new ResolveComReference.AxImp();
            string testParameterValue = @"c:\Program Files\AxInterop.Foo.dll";

            Assert.Null(t.OutputAssembly); // "OutputAssembly should be null by default"
            CommandLine.ValidateNoParameterStartsWith(t, @"/out:", false /* no response file */);

            t.OutputAssembly = testParameterValue;
            Assert.Equal(testParameterValue, t.OutputAssembly); // "New OutputAssembly value should be set"
            CommandLine.ValidateHasParameter(t, @"/out:" + testParameterValue, false /* no response file */);
        }
예제 #15
0
파일: AxImp_Tests.cs 프로젝트: 3F/IeXod
        public void NoLogo()
        {
            if (!NativeMethodsShared.IsWindows)
            {
                return; // "The /nologo switch is not available on Mono"
            }

            var t = new ResolveComReference.AxImp();

            Assert.False(t.NoLogo); // "NoLogo should be false by default"
            CommandLine.ValidateNoParameterStartsWith(t, @"/nologo", false /* no response file */);

            t.NoLogo = true;
            Assert.True(t.NoLogo); // "NoLogo should be true"
            CommandLine.ValidateHasParameter(t, @"/nologo", false /* no response file */);
        }
예제 #16
0
        public void TaskFailsWithNoInputs()
        {
            var t = new ResolveComReference.AxImp();

            Utilities.ExecuteTaskAndVerifyLogContainsErrorFromResource(t, "AxImp.NoInputFileSpecified");
        }