Exemplo n.º 1
0
    public void SignalEx_AddListenerAndDispatch_Success()
    {
        // Arrange
        var actual = 0;

        // Act
        var signal = new SignalEx();

        signal.AddListener(ActionRuntime);
        signal.Dispatch();

        void ActionRuntime() => actual++;

        //Assert
        Assert.AreEqual(1, actual);
    }
Exemplo n.º 2
0
    public void SignalEx_RemoveAllListeners_Success()
    {
        // Arrange
        var actual = 0;

        // Act
        var signal = new SignalEx();

        signal.AddListener(ActionRuntime);
        signal.AddListenerOnce(ActionRuntime);
        signal.RemoveAllListeners();
        signal.Dispatch();

        void ActionRuntime() => actual++;

        //Assert
        Assert.AreEqual(0, actual);
    }