public void BuildInvokesAfterBuildEvent() { var wasInvoked = false; if (File.Exists("OutputFile4.txt")) { File.Delete("OutputFile4.txt"); } var project = new MetalsharpProject().AddOutput(new MetalsharpFile("text", "OutputFile4.txt")); project.AfterBuild += (sender, e) => { wasInvoked = true; // File may or may not exist here - cannot test this? }; project.Build(proj => Assert.False(wasInvoked), new BuildOptions()); Assert.True(wasInvoked); }
public void BuildInvokesBeforeBuildEvent() { var wasInvoked = false; if (File.Exists("OutputFile3.txt")) { File.Delete("OutputFile3.txt"); } var project = new MetalsharpProject().AddOutput(new MetalsharpFile("text", "OutputFile3.txt")); project.BeforeBuild += (sender, e) => { wasInvoked = true; Assert.False(File.Exists("OutputFile3.txt")); }; project.Build(proj => Assert.True(wasInvoked), new BuildOptions()); Assert.True(wasInvoked); }