public void ReleaseViewComponent_CallsDispose_OnTheInstance()
    {
        // Arrange
        var context = new ViewComponentContext
        {
        };

        var component = new ActivablePropertiesViewComponent();

        var viewComponentActivator = new Mock <IViewComponentActivator>();

        viewComponentActivator.Setup(vca => vca.Release(context, component))
        .Callback <ViewComponentContext, object>((c, o) => (o as IDisposable)?.Dispose());

        var factory = new DefaultViewComponentFactory(viewComponentActivator.Object);

        // Act
        factory.ReleaseViewComponent(context, component);

        // Assert
        Assert.True(component.Disposed);
    }
    public void CreateViewComponent_ActivatesProperties_OnTheInstance()
    {
        // Arrange
        var context = new ViewComponentContext
        {
        };

        var component = new ActivablePropertiesViewComponent();
        var activator = new Mock <IViewComponentActivator>();

        activator.Setup(a => a.Create(context))
        .Returns(component);

        var factory = new DefaultViewComponentFactory(activator.Object);

        // Act
        var result = factory.CreateViewComponent(context);

        // Assert
        var activablePropertiesComponent = Assert.IsType <ActivablePropertiesViewComponent>(result);

        Assert.Same(component, activablePropertiesComponent);
        Assert.Same(component.Context, activablePropertiesComponent.Context);
    }