コード例 #1
0
    public void CommandContainer_UnbindGeneric_ReturnFalse()
    {
        // Arrange
        var container = new DiContainer();

        // Act
        var commandContainer = new CommandContainer(container);
        var actual           = commandContainer.Unbind <CommandTest>();

        //Assert
        Assert.IsFalse(actual);
    }
コード例 #2
0
    public void CommandContainer_UnbindGeneric_ReturnTrue()
    {
        // Arrange
        var container        = new DiContainer();
        var commandContainer = new CommandContainer(container);

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

        // Act
        var actual = commandContainer.Unbind <CommandTest>();

        //Assert
        Assert.IsTrue(actual);
    }
コード例 #3
0
    public void CommandContainer_UnbindLifeTime_AreEqual()
    {
        // Arrange
        var container        = new DiContainer();
        var commandContainer = new CommandContainer(container);
        var expected         = commandContainer.Bind <CommandTest>();

        expected.InLocal()
        .InParallel()
        .To <CommandTest>();

        // Act
        commandContainer.Unbind(LifeTime.Global);
        var actual = commandContainer.Bind <CommandTest>();

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