Пример #1
0
    public void CommandContainer_ReactToGenericAndData()
    {
        // Arrange
        var expected         = new Test();
        var container        = new DiContainer();
        var commandContainer = new CommandContainer(container);

        CommandTest.Callback = () => { };

        commandContainer.Bind <CommandTest>()
        .InGlobal()
        .InParallel()
        .To <CommandTest>();

        // Act
        commandContainer.ReactTo <CommandTest>(expected);
        var actual = CommandTest.DataTest;

        //Assert
        Assert.AreEqual(expected, actual);
    }
Пример #2
0
    public void CommandContainer_ReactToGeneric()
    {
        // Arrange
        var actual           = 0;
        var container        = new DiContainer();
        var commandContainer = new CommandContainer(container);

        CommandTest.Callback = () => actual++;

        commandContainer.Bind <CommandTest>()
        .InGlobal()
        .InParallel()
        .To <CommandTest>()
        .To <CommandTest>();

        // Act
        commandContainer.ReactTo <CommandTest>();

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