Ejemplo n.º 1
0
    public void DIBinding_InLocal_IsInvalidOperationException()
    {
        // Arrange
        var actual    = false;
        var reflector = new Reflector();
        var container = new DiContainer();
        var key       = typeof(Test);
        var binding   = new DiBinding(reflector, container, key, null, null);

        binding.InLocal();

        // Act
        try
        {
            binding.InLocal();
        }
        catch (InvalidOperationException)
        {
            actual = true;
        }

        // Assert
        Assert.IsTrue(actual);
    }
Ejemplo n.º 2
0
    public void DIBinding_InLocal()
    {
        // Arrange
        var reflector = new Reflector();
        var container = new DiContainer();
        var key       = typeof(Test);
        var binding   = new DiBinding(reflector, container, key, null, null);

        // Act
        binding.InLocal();
        var actual = binding.LifeTime;

        // Assert
        Assert.AreEqual(LifeTime.Local, actual);
    }