Exemplo n.º 1
0
    public void CommandBinding_InGlobal_Exception()
    {
        // Arrange
        var actual    = false;
        var container = new CommandContainerTest();
        var key       = typeof(object);
        var binder    = new CommandBinding(container, key, null, null);

        binder.InGlobal();

        // Act
        try
        {
            binder.InGlobal();
        }
        catch (InvalidOperationException)
        {
            actual = true;
        }

        // Assert
        Assert.IsTrue(actual);
    }
Exemplo n.º 2
0
    public void CommandBinding_InGlobal()
    {
        // Arrange
        var container = new CommandContainerTest();
        var key       = typeof(object);
        var binder    = new CommandBinding(container, key, null, null);

        // Act
        binder.InGlobal();
        var actual = binder.LifeTime;

        // Assert
        Assert.AreEqual(LifeTime.Global, actual);
    }
Exemplo n.º 3
0
    public void CommandBinding_InParallel()
    {
        // Arrange
        var container = new CommandContainerTest();
        var key       = typeof(object);
        var binder    = new CommandBinding(container, key, null, null);

        binder.InGlobal().InParallel();

        // Act
        var actual = binder.IsSequence;

        // Assert
        Assert.IsFalse(actual);
    }
Exemplo n.º 4
0
    public void CommandBinding_ExecuteAndInParallel()
    {
        // Arrange
        var container = new CommandContainerTest();
        var key       = typeof(object);
        var binder    = new CommandBinding(container, key, null, null);

        // Act
        binder.InGlobal()
        .InParallel()
        .To <CommandTest>()
        .Execute();

        var actual = container.IsExecuted;

        // Assert
        Assert.IsTrue(actual);
    }
Exemplo n.º 5
0
    public void CommandBinding_InSequenceAnd2To()
    {
        // Arrange
        var container = new CommandContainerTest();
        var key       = typeof(object);
        var binder    = new CommandBinding(container, key, null, null);

        // Act
        binder.InGlobal()
        .InSequence()
        .To <CommandTest>()
        .To <CommandTest>();
        var values = binder.Values;
        var actual = values.Count();

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