mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-19 20:39:01 +00:00
36 lines
791 B
C#
36 lines
791 B
C#
using System;
|
|
using Cosmos.TestRunner;
|
|
|
|
namespace Cosmos.Compiler.Tests.Bcl.System
|
|
{
|
|
internal class TestClass
|
|
{
|
|
private static bool handlerInvoked;
|
|
|
|
public event EventHandler EventFired = (sender, args) =>
|
|
{
|
|
handlerInvoked = true;
|
|
};
|
|
|
|
private void OnEventFired(EventArgs e)
|
|
{
|
|
EventHandler handler = EventFired;
|
|
handler?.Invoke(this, e);
|
|
}
|
|
|
|
public bool ExecuteTest()
|
|
{
|
|
OnEventFired(null);
|
|
return handlerInvoked;
|
|
}
|
|
}
|
|
|
|
public class EventsTest
|
|
{
|
|
public static void Execute()
|
|
{
|
|
var test = new TestClass();
|
|
Assert.IsTrue(test.ExecuteTest(), "Event handler was not invoked.");
|
|
}
|
|
}
|
|
}
|