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); }
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); }
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); }
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); }