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.IsFalse(retval); e.AssertLogDoesntContain("a.txt"); e.AssertLogContains("MSB3861"); Assert.IsTrue(e.Errors == 1); }
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.IsFalse(retval); string message = AssemblyResources.GetString(err.Resource); string updatedMessage = message.Replace("MSB3072", "ABC1234"); e.AssertLogContains(updatedMessage); Assert.IsTrue(e.Errors == 1); }
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.IsFalse(retval); string message = String.Format(AssemblyResources.GetString(err.Resource), err.Arguments); e.AssertLogContains(message); Assert.IsTrue(e.Errors == 1); }
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.IsFalse(retval); string message = AssemblyResources.GetString(err.Resource); e.AssertLogContains(message); Assert.IsTrue(e.Errors == 1); }