Skip to content

Component does not re-render if InputFile control included in Razor markup #318

Answered by egil
mrakestraw-bbins asked this question in Q&A
Discussion options

You must be logged in to vote

OK, this turns out not to be a race condition or a bug, per say... but more a problem with bUnit not having built in support for the <InputFile> component.

Here is how to write the test, using a mocking framework of choice, to create a mock of the IOptions<RemoteBrowserFileStreamOptions> that InputFile requires.

using System;
using System.Collections.Generic;
using BBINS.Shared;
using Bunit;
using Bunit.JSInterop;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using NSubstitute;
using RichardSzalay.MockHttp;
using Xunit;

namespace Client.Test
{
    public class WeatherDisplayTests : TestContext
    {
        

Replies: 6 comments 7 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
7 replies
@iatharva
Comment options

@egil
Comment options

@iatharva
Comment options

@egil
Comment options

@iatharva
Comment options

Answer selected by egil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #314 on February 06, 2021 10:41.