Exemplo n.º 1
0
        public void ErrorFromResourcesWithInvalidArguments()
        {
            MockEngine         e   = new MockEngine(true);
            ErrorFromResources err = new ErrorFromResources();

            err.BuildEngine = e;

            err.Resource  = "Copy.Error";
            err.Arguments = new string[] { "a.txt", "b.txt" };

            bool retval = err.Execute();

            Console.WriteLine("===");
            Console.WriteLine(e.Log);
            Console.WriteLine("===");

            Assert.False(retval);

            e.AssertLogDoesntContain("a.txt");
            e.AssertLogContains("MSB3861");
            Assert.Equal(1, e.Errors);
        }
Exemplo n.º 2
0
        public void ErrorFromResources()
        {
            MockEngine         e   = new MockEngine(true);
            ErrorFromResources err = new ErrorFromResources();

            err.BuildEngine = e;

            err.Resource = "Exec.MissingCommandError";

            bool retval = err.Execute();

            Console.WriteLine("===");
            Console.WriteLine(e.Log);
            Console.WriteLine("===");

            Assert.False(retval);

            string message = AssemblyResources.GetString(err.Resource);

            e.AssertLogContains(message);
            Assert.Equal(1, e.Errors);
        }
Exemplo n.º 3
0
        public void ErrorFromResourcesWithArguments()
        {
            MockEngine         e   = new MockEngine(true);
            ErrorFromResources err = new ErrorFromResources();

            err.BuildEngine = e;

            err.Resource  = "Copy.Error";
            err.Arguments = new string[] { "a.txt", "b.txt", "xyz" };

            bool retval = err.Execute();

            Console.WriteLine("===");
            Console.WriteLine(e.Log);
            Console.WriteLine("===");

            Assert.False(retval);

            string message = String.Format(AssemblyResources.GetString(err.Resource), err.Arguments);

            e.AssertLogContains(message);
            Assert.Equal(1, e.Errors);
        }
Exemplo n.º 4
0
        public void ErrorFromResourcesWithOverriddenCode()
        {
            MockEngine         e   = new MockEngine(true);
            ErrorFromResources err = new ErrorFromResources();

            err.BuildEngine = e;

            err.Resource = "Exec.MissingCommandError";
            err.Code     = "ABC1234";

            bool retval = err.Execute();

            Console.WriteLine("===");
            Console.WriteLine(e.Log);
            Console.WriteLine("===");

            Assert.False(retval);

            string message        = AssemblyResources.GetString(err.Resource);
            string updatedMessage = message.Replace("MSB3072", "ABC1234");

            e.AssertLogContains(updatedMessage);
            Assert.Equal(1, e.Errors);
        }