File: Forms\InputTextTest.cs
Web Access
Project: src\src\Components\Web\test\Microsoft.AspNetCore.Components.Web.Tests.csproj (Microsoft.AspNetCore.Components.Web.Tests)
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
 
namespace Microsoft.AspNetCore.Components.Forms;
 
public class InputTextTest
{
    [Fact]
    public async Task InputElementIsAssignedSuccessfully()
    {
        // Arrange
        var model = new TestModel();
        var rootComponent = new TestInputHostComponent<string, InputText>
        {
            EditContext = new EditContext(model),
            ValueExpression = () => model.StringProperty,
        };
 
        // Act
        var inputSelectComponent = await InputRenderer.RenderAndGetComponent(rootComponent);
 
        // Assert
        Assert.NotNull(inputSelectComponent.Element);
    }
 
    private class TestModel
    {
        public string StringProperty { get; set; }
    }
}