Пример #1
0
        public void CheckBoxFormTest1()
        {
            using var ctx = new Bunit.TestContext();
            var comp = ctx.RenderComponent <CheckBoxFormTest1>();

            // print the generated html
            Console.WriteLine(comp.Markup);
            var form = comp.FindComponent <MudForm>().Instance;

            form.IsValid.Should().BeFalse();
            form.Errors.Length.Should().Be(0);
            var checkbox = comp.FindComponent <MudCheckBox <bool> >();

            // click the checkbox to make the form valid
            checkbox.Find("input").Change(true);
            form.IsValid.Should().BeTrue();
            // click the checkbox to make the form invalid again because the checkbox is required
            checkbox.Find("input").Change(false);
            checkbox.Instance.Error.Should().BeTrue();
            checkbox.Instance.ErrorText.Should().Be("You must agree");
            form.IsValid.Should().BeFalse();
            form.Errors.Length.Should().Be(1);
            form.Errors[0].Should().Be("You must agree");
            // click the checkbox to make the form valid again
            checkbox.Find("input").Change(true);
            form.IsValid.Should().BeTrue();
            checkbox.Instance.Error.Should().BeFalse();
            checkbox.Instance.ErrorText.Should().Be(null);
        }
Пример #2
0
        public void AllMudComponents_ShouldForwardUserAttributes()
        {
            // Arrange
            using var testContext = new TestContext();
            testContext.AddTestServices();
            testContext.Services.Add(new ServiceDescriptor(typeof(IResizeObserver), new MockResizeObserver()));

            var componentFactory = new MudComponentFactory
            {
                UserAttributes = new Dictionary <string, object> {
                    { "data-testid", "test-123" }
                },
            };

            // Act & Assert
            var mudComponentTypes = GetMudComponentTypes();

            mudComponentTypes.Should().NotBeEmpty();
            foreach (var componentType in mudComponentTypes)
            {
                var component = componentFactory.Create(componentType, testContext);

                component.Markup.Should()
                .NotBeEmpty(because: $"the component {componentType.Name} should at least contain one element");

                var elementsWithUserAttributes = component.FindAll("[data-testid='test-123']");
                elementsWithUserAttributes.Should()
                .NotBeEmpty(because: $"UserAttributes should be forwarded by component {componentType.Name}");
            }
        }
Пример #3
0
        public void CheckBoxTest3()
        {
            using var ctx = new Bunit.TestContext();
            var comp = ctx.RenderComponent <CheckBoxTest3>();

            // print the generated html
            Console.WriteLine(comp.Markup);
            // select elements needed for the test
            var boxes  = comp.FindComponents <MudCheckBox <bool> >();
            var inputs = comp.FindAll("input");

            // check initial state
            boxes[0].Instance.Checked.Should().Be(true);
            boxes[1].Instance.Checked.Should().Be(true);
            // click and check if it has toggled
            inputs[0].Change(false);
            boxes[0].Instance.Checked.Should().Be(false);
            boxes[1].Instance.Checked.Should().Be(false);
            inputs = comp.FindAll("input");
            inputs[0].Change(true);
            boxes[0].Instance.Checked.Should().Be(true);
            boxes[1].Instance.Checked.Should().Be(true);
            inputs = comp.FindAll("input");
            inputs[1].Change(false);
            boxes[0].Instance.Checked.Should().Be(false);
            boxes[1].Instance.Checked.Should().Be(false);
            inputs = comp.FindAll("input");
            inputs[1].Change(true);
            boxes[0].Instance.Checked.Should().Be(true);
            boxes[1].Instance.Checked.Should().Be(true);
        }
        public void TestRefreshRender()
        {
            InitializeHttpContext();
            using var ctx = new Bunit.TestContext();

            string infoMessage = "Info message";

            InfoMessage(infoMessage);

            var renderedComponent = ctx.RenderComponent <FeedbackMessagePanel>();

            // information message
            var infoArea = renderedComponent.Find(".feedback-info");

            Assert.AreEqual("ul", infoArea.TagName.ToLower());
            Assert.AreEqual(1, infoArea.ChildElementCount);
            Assert.AreEqual(infoMessage, infoArea.Children[0].InnerHtml);

            // refresh component
            string warnMessage = "Warn message";

            WarnMessage(warnMessage);
            renderedComponent.InvokeAsync(() => renderedComponent.Instance.RefreshRender());

            // warning message
            var warnArea = renderedComponent.Find(".feedback-warn");

            Assert.AreEqual("ul", warnArea.TagName.ToLower());
            Assert.AreEqual(1, warnArea.ChildElementCount);
            Assert.AreEqual(warnMessage, warnArea.Children[0].InnerHtml);
        }
Пример #5
0
        public void CheckBoxTest3()
        {
            // there are two checkboxes synced via a bound variable, so checking one also check the other and vice versa.
            // setup
            using var ctx = new Bunit.TestContext();
            var comp = ctx.RenderComponent <CheckBoxTest3>();

            // print the generated html
            Console.WriteLine(comp.Markup);
            // select elements needed for the test
            var boxes  = comp.FindComponents <MudCheckBox>();
            var inputs = comp.FindAll("input");

            // check initial state
            boxes[0].Instance.Checked.Should().Be(true);
            boxes[1].Instance.Checked.Should().Be(true);
            // click and check if it has toggled
            inputs[0].Change(false);
            boxes[0].Instance.Checked.Should().Be(false);
            boxes[1].Instance.Checked.Should().Be(false);
            inputs = comp.FindAll("input");
            inputs[0].Change(true);
            boxes[0].Instance.Checked.Should().Be(true);
            boxes[1].Instance.Checked.Should().Be(true);
            inputs = comp.FindAll("input");
            inputs[1].Change(false);
            boxes[0].Instance.Checked.Should().Be(false);
            boxes[1].Instance.Checked.Should().Be(false);
            inputs = comp.FindAll("input");
            inputs[1].Change(true);
            boxes[0].Instance.Checked.Should().Be(true);
            boxes[1].Instance.Checked.Should().Be(true);
        }
Пример #6
0
        public void TableMultiSelectionTest5()
        {
            using var ctx = new Bunit.TestContext();
            ctx.Services.AddSingleton <NavigationManager>(new MockNavigationManager());
            var comp = ctx.RenderComponent <TableMultiSelectionTest5>();

            // print the generated html
            Console.WriteLine(comp.Markup);
            // select elements needed for the test
            var table      = comp.FindComponent <MudTable <int> >().Instance;
            var text       = comp.FindComponent <MudText>();
            var checkboxes = comp.FindComponents <MudCheckBox <bool> >().Select(x => x.Instance).ToArray();

            table.SelectedItems.Count.Should().Be(4);
            comp.Find("p").TextContent.Should().Be("SelectedItems { 0, 1, 2, 3 }");
            checkboxes.Sum(x => x.Checked ? 1 : 0).Should().Be(3);
            // uncheck a row then switch to page 2 and both checkboxes on page 2 should be checked
            comp.InvokeAsync(() => checkboxes[1].Checked = false);
            comp.WaitForState(() => checkboxes[1].Checked == false);
            checkboxes.Sum(x => x.Checked ? 1 : 0).Should().Be(1);
            // switch page
            comp.InvokeAsync(() => table.CurrentPage = 1);
            comp.WaitForState(() => table.CurrentPage == 1);
            // now two checkboxes should be checked on page 2
            checkboxes = comp.FindComponents <MudCheckBox <bool> >().Select(x => x.Instance).ToArray();
            checkboxes.Sum(x => x.Checked ? 1 : 0).Should().Be(2);
        }
Пример #7
0
        public void TableMultiSelectionTest1()
        {
            // the selected items (check-box click or row click) should be in SelectedItems
            // setup
            using var ctx = new Bunit.TestContext();
            var comp = ctx.RenderComponent <TableMultiSelectionTest1>();

            // print the generated html
            Console.WriteLine(comp.Markup);
            // select elements needed for the test
            var table = comp.FindComponent <MudTable <int> >().Instance;
            var text  = comp.FindComponent <MudText>();
            var tr    = comp.FindAll("tr").ToArray();

            tr.Length.Should().Be(3);
            var td = comp.FindAll("td").ToArray();

            td.Length.Should().Be(6); // two td per row for multi selection
            var inputs = comp.FindAll("input").ToArray();

            inputs.Length.Should().Be(3);             // one checkbox per row
            table.SelectedItems.Count.Should().Be(0); // selected items should be empty
            // click checkboxes and verify selection text
            inputs[0].Change(true);
            table.SelectedItems.Count.Should().Be(1);
            comp.Find("p").TextContent.Should().Be("SelectedItems { 0 }");
            inputs = comp.FindAll("input").ToArray();
            inputs[0].Change(false);
            table.SelectedItems.Count.Should().Be(0);
            comp.Find("p").TextContent.Should().Be("SelectedItems {  }");
            // row click
            tr[1].Click();
            comp.Find("p").TextContent.Should().Be("SelectedItems { 1 }");
        }
Пример #8
0
        public async Task SelectUnrepresentableValueTest2()
        {
            using var ctx = new Bunit.TestContext();
            ctx.Services.AddSingleton <NavigationManager>(new MockNavigationManager());
            var comp = ctx.RenderComponent <SelectUnrepresentableValueTest2>();

            // print the generated html
            Console.WriteLine(comp.Markup);
            // select elements needed for the test
            var select = comp.FindComponent <MudSelect <int> >();

            select.Instance.Value.Should().Be(17);
            select.Instance.Text.Should().Be("17");
            await Task.Delay(100);

            // BUT: we have a select with Strict="true" so the Text will not be shown because it is not in the list of selectable values
            comp.FindComponent <MudInput <string> >().Instance.Value.Should().Be(null);
            comp.FindComponent <MudInput <string> >().Instance.InputType.Should().Be(InputType.Hidden);
            var items = comp.FindAll("div.mud-list-item").ToArray();

            items[1].Click();
            select.Instance.Value.Should().Be(2);
            select.Instance.Text.Should().Be("2");
            comp.FindComponent <MudInput <string> >().Instance.Value.Should().Be("2");
            comp.FindComponent <MudInput <string> >().Instance.InputType.Should().Be(InputType.Text); // because list item has no render fragment, so we show it as text
        }
Пример #9
0
        public async Task AutocompleteTest2()
        {
            using var ctx = new Bunit.TestContext();
            ctx.Services.AddSingleton <NavigationManager>(new MockNavigationManager());
            var comp = ctx.RenderComponent <AutocompleteTest2>();

            // print the generated html
            Console.WriteLine(comp.Markup);
            // select elements needed for the test
            var select       = comp.FindComponent <MudAutocomplete <string> >();
            var menu         = comp.Find("div.mud-popover");
            var inputControl = comp.Find("div.mud-input-control");

            // check initial state
            menu.ClassList.Should().NotContain("mud-popover-open");

            // click and check if it has toggled the menu
            inputControl.Click();
            await Task.Delay(100);

            menu.ClassList.Should().NotContain("mud-popover-open");

            // type 3 characters and check if it has toggled the menu
            select.Instance.Text = "ala";
            await Task.Delay(100);

            menu.ClassList.Should().Contain("mud-popover-open");

            // type 2 characters and check if it has toggled the menu
            select.Instance.Text = "al";
            await Task.Delay(100);

            menu.ClassList.Should().NotContain("mud-popover-open");
        }
Пример #10
0
 public void Setup()
 {
     ctx = new Bunit.TestContext();
     ctx.JSInterop.Mode = JSRuntimeMode.Loose;
     ctx.Services.AddSingleton <NavigationManager>(new MockNavigationManager());
     ctx.Services.AddSingleton <IDialogService>(new DialogService());
     ctx.Services.AddSingleton <ISnackbar, SnackbarService>();
     ctx.Services.AddSingleton <IResizeListenerService>(new MockResizeListenerService());
     ctx.Services.AddSingleton <IResizeService>(new MockResizeService());
     ctx.Services.AddSingleton <IBreakpointService>(new MockBreakpointService());
     ctx.Services.AddTransient <IScrollManager, MockScrollManager>();
     ctx.Services.AddTransient <IScrollListener, MockScrollListener>();
     ctx.Services.AddTransient <IJsApiService, MockJsApiServices>();
     ctx.Services.AddTransient <IResizeObserver, MockResizeObserver>();
     ctx.Services.AddTransient <IScrollSpy, MockScrollSpy>();
     ctx.Services.AddTransient <IEventListener, MockEventListener>();
     ctx.Services.AddSingleton <IBrowserWindowSizeProvider>(new MockBrowserWindowSizeProvider());
     ctx.Services.AddSingleton <IDocsNavigationService, DocsNavigationService>();
     ctx.Services.AddSingleton <IMenuService, MenuService>();
     ctx.Services.AddSingleton <IMudPopoverService, MockPopoverService>();
     ctx.Services.AddTransient <IKeyInterceptor, MockKeyInterceptorService>();
     ctx.Services.AddTransient <IJsEvent, MockJsEvent>();
     ctx.Services.AddSingleton <IRenderQueueService, RenderQueueService>();
     ctx.Services.AddScoped(sp => new HttpClient());
 }
Пример #11
0
        public async Task ShouldRespectDebounceIntervalPropertyInTextFieldTest()
        {
            //Arrange
            using var ctx = new Bunit.TestContext();
            var interval  = Parameter(nameof(MudTextField <string> .DebounceInterval), 1000d);
            var comp      = ctx.RenderComponent <MudTextField <string> >(interval);
            var textField = comp.Instance;
            var input     = comp.Find("input");

            //Act
            input.Input(new ChangeEventArgs()
            {
                Value = "Some Value"
            });

            //Assert
            //if DebounceInterval is set, Immediate should be true by default
            textField.Immediate.Should().BeTrue();

            //input value has changed, but elapsed time is 0, so Value should not change in TextField
            textField.Value.Should().BeNull();

            //DebounceInterval is 1000 ms, so at 500 ms Value should not change in TextField
            await Task.Delay(500);

            textField.Value.Should().BeNull();

            //More than 1000 ms had elapsed, so Value should be updated
            await Task.Delay(550);

            textField.Value.Should().Be("Some Value");
        }
Пример #12
0
 public void Setup()
 {
     ctx = new Bunit.TestContext();
     ctx.JSInterop.Mode = JSRuntimeMode.Loose;
     ctx.Services.AddSingleton <NavigationManager>(new MockNavigationManager());
     ctx.Services.AddSingleton <IDialogService>(new DialogService());
     ctx.Services.AddSingleton <ISnackbar, SnackbarService>();
     ctx.Services.AddSingleton <IResizeListenerService>(new MockResizeListenerService());
     ctx.Services.AddSingleton <IResizeService>(new MockResizeService());
     ctx.Services.AddSingleton <IBreakpointService>(new MockBreakpointService());
     ctx.Services.AddTransient <IScrollManager, MockScrollManager>();
     ctx.Services.AddTransient <IScrollListener, MockScrollListener>();
     ctx.Services.AddTransient <IJsApiService, MockJsApiServices>();
     ctx.Services.AddTransient <IResizeObserver, MockResizeObserver>();
     ctx.Services.AddSingleton <IBrowserWindowSizeProvider>(new MockBrowserWindowSizeProvider());
     ctx.Services.AddTransient <IEventListener, EventListener>();
     ctx.Services.AddTransient <IKeyInterceptor, MockKeyInterceptorService>();
     ctx.Services.AddSingleton <IMudPopoverService, MockPopoverService>();
     ctx.Services.AddSingleton <IRenderQueueService, RenderQueueService>();
     ctx.Services.AddOptions();
     ctx.Services.AddScoped(sp =>
                            new HttpClient(new MockDocsMessageHandler())
     {
         BaseAddress = new Uri("https://localhost/")
     });
 }
Пример #13
0
        public async Task SelectWithEnumTest()
        {
            // Initial Text should be enums default value
            // setup
            using var ctx = new Bunit.TestContext();
            ctx.Services.AddSingleton <NavigationManager>(new MockNavigationManager());
            var comp = ctx.RenderComponent <SelectWithEnumTest>();

            // print the generated html
            Console.WriteLine(comp.Markup);
            // select elements needed for the test
            var select = comp.FindComponent <MudSelect <MyEnum> >();

            select.Instance.Value.Should().Be(default(MyEnum));
            select.Instance.Text.Should().Be(default(MyEnum).ToString());
            await Task.Delay(50);

            comp.Find("div.mud-input-slot").TextContent.Trim().Should().Be("First");
            comp.RenderCount.Should().Be(2);
            //Console.WriteLine(comp.Markup);
            var items = comp.FindAll("div.mud-list-item").ToArray();

            items[1].Click();
            comp.Find("div.mud-input-slot").TextContent.Trim().Should().Be("Second");
            comp.RenderCount.Should().Be(3);
        }
Пример #14
0
        public void SelectTest1()
        {
            // Click should open the Menu and selecting a value should update the bindable value.
            // setup
            using var ctx = new Bunit.TestContext();
            ctx.Services.AddSingleton <NavigationManager>(new MockNavigationManager());
            var comp = ctx.RenderComponent <SelectTest1>();

            // print the generated html
            Console.WriteLine(comp.Markup);
            // select elements needed for the test
            var select = comp.FindComponent <MudSelect <string> >();
            var menu   = comp.Find("div.mud-popover");
            var input  = comp.Find("div.mud-input-control");

            // check initial state
            select.Instance.Value.Should().BeNullOrEmpty();
            menu.ClassList.Should().NotContain("mud-popover-open");
            // click and check if it has toggled the menu
            input.Click();
            menu.ClassList.Should().Contain("mud-popover-open");

            // now click an item and see the value change
            var items = comp.FindAll("div.mud-list-item").ToArray();

            items[1].Click();
            // menu should be closed now
            menu.ClassList.Should().NotContain("mud-popover-open");
            select.Instance.Value.Should().Be("2");
            // now we cheat and click the list without opening the menu ;)
            items[0].Click();
            select.Instance.Value.Should().Be("1");
        }
Пример #15
0
        public void TableMultiSelectionTest4()
        {
            //The checkboxes should all be checked on load, even the header checkbox.
            // setup
            using var ctx = new Bunit.TestContext();
            var comp = ctx.RenderComponent <TableMultiSelectionTest4>();

            // print the generated html
            Console.WriteLine(comp.Markup);
            // select elements needed for the test
            var table      = comp.FindComponent <MudTable <int> >().Instance;
            var text       = comp.FindComponent <MudText>();
            var checkboxes = comp.FindComponents <MudCheckBox <bool> >().Select(x => x.Instance).ToArray();

            table.SelectedItems.Count.Should().Be(3);
            comp.Find("p").TextContent.Should().Be("SelectedItems { 0, 1, 2 }");
            checkboxes.Sum(x => x.Checked ? 1 : 0).Should().Be(4);
            // uncheck only row 1 => header checkbox should be off then
            comp.InvokeAsync(() => {
                checkboxes[2].Checked = false;
            });
            comp.WaitForState(() => checkboxes[2].Checked == false);
            checkboxes[0].Checked.Should().Be(false); // header checkbox should be off
            table.SelectedItems.Count.Should().Be(2);
            comp.Find("p").TextContent.Should().Be("SelectedItems { 0, 2 }");
            checkboxes.Sum(x => x.Checked ? 1 : 0).Should().Be(2);
        }
Пример #16
0
        public void ReadOnlyRating_ShouldNotRenderInputs()
        {
            using var ctx = new Bunit.TestContext();
            var comp = ctx.RenderComponent <MudRating>(Parameter("ReadOnly", true));

            comp.FindAll("input").Should().BeEmpty();
        }
Пример #17
0
        public void TableMultiSelectionTest3()
        {
            // Initially the values bound to SelectedItems should be selected
            // setup
            using var ctx = new Bunit.TestContext();
            var comp = ctx.RenderComponent <TableMultiSelectionTest3>();

            // print the generated html
            Console.WriteLine(comp.Markup);
            // select elements needed for the test
            var table      = comp.FindComponent <MudTable <int> >().Instance;
            var text       = comp.FindComponent <MudText>();
            var checkboxes = comp.FindComponents <MudCheckBox <bool> >().Select(x => x.Instance).ToArray();

            table.SelectedItems.Count.Should().Be(1); // selected items should be empty
            comp.Find("p").TextContent.Should().Be("SelectedItems { 1 }");
            checkboxes.Sum(x => x.Checked ? 1 : 0).Should().Be(1);
            checkboxes[0].Checked.Should().Be(false);
            checkboxes[2].Checked.Should().Be(true);
            // uncheck it
            comp.InvokeAsync(() => {
                checkboxes[2].Checked = false;
            });
            comp.WaitForState(() => checkboxes[2].Checked == false);
            table.SelectedItems.Count.Should().Be(0);
            comp.Find("p").TextContent.Should().Be("SelectedItems {  }");
            checkboxes.Sum(x => x.Checked ? 1 : 0).Should().Be(0);
        }
Пример #18
0
        public void TestRenderScript()
        {
            InitializeHttpContext();
            InitializeSettings();
            using var ctx = new Bunit.TestContext();

            string renderMessage = "Info message";

            InfoMessage(renderMessage);

            var renderedComponent = ctx.RenderComponent <FeedbackMessageScript>();

            // information message
            var scriptElement = renderedComponent.Find("#fms");

            Assert.AreEqual("script", scriptElement.TagName.ToLower());
            Assert.AreEqual(0, scriptElement.ChildElementCount);
            Assert.IsTrue(scriptElement.InnerHtml.Contains("function renderFeedbackMessage()"));

            var attr = scriptElement.Attributes["data-fmscript"];

            Assert.AreEqual("alert('Info message');", attr.Value);

            ctx.JSInterop.VerifyInvoke("renderFeedbackMessage");
        }
Пример #19
0
 public void Setup()
 {
     ctx = new Bunit.TestContext();
     ctx.Services.AddSingleton <NavigationManager>(new MockNavigationManager());
     ctx.Services.AddSingleton <IDialogService>(new DialogService());
     ctx.Services.AddSingleton <ISnackbar>(new MockSnackbar());
     ctx.Services.AddSingleton <IResizeListenerService>(new MockResizeListenerService());
 }
        public void Init()
        {
            _testContext = new Bunit.TestContext();

            var mock = new Mock <ILogger <AdvancedTimer> >();

            _testContext.Services.Add(new ServiceDescriptor(typeof(ILogger <AdvancedTimer>), mock.Object));
        }
Пример #21
0
        public void DefaultValueTest()
        {
            using var ctx = new Bunit.TestContext();
            ctx.Services.AddSingleton <NavigationManager>(new MockNavigationManager());
            var comp = ctx.RenderComponent <MudToggleIconButton>();

            comp.Instance.Toggled.Should().BeFalse();
        }
Пример #22
0
        public void Setup()
        {
            _eventListener = new MockEventListener();

            ctx = new Bunit.TestContext();
            ctx.AddTestServices();
            ctx.Services.AddSingleton <IEventListener>(_eventListener);
        }
Пример #23
0
        public void Init()
        {
            _testContext = new Bunit.TestContext();

            var mock = new Mock <ILogger <ToggleSwitch> >();

            _testContext.Services.Add(new ServiceDescriptor(typeof(ILogger <ToggleSwitch>), mock.Object));
        }
Пример #24
0
        public static void Initialize()
        {
            var host      = new Bunit.TestContext();
            var component = host.RenderComponent <SurveyPrompt>();
            var titleNode = component.Find("strong");

            Assert.That(titleNode.TextContent, Is.EqualTo(string.Empty));
        }
        public void Init()
        {
            _testContext = new Bunit.TestContext();

            var mock = new Mock <ILogger <LoadingElement> >();

            _testContext.Services.Add(new ServiceDescriptor(typeof(ILogger <LoadingElement>), mock.Object));
        }
Пример #26
0
    public PrerenderTasks()
    {
        Context = new();
        var config = new ConfigurationBuilder().AddJsonFile("appsettings.json").Build();

        ClientDir = config[nameof(ClientDir)]
                    ?? throw new Exception($"{nameof(ClientDir)} not defined in appsettings.json");
        FileSystemVirtualFiles.RecreateDirectory(PrerenderDir);
    }
Пример #27
0
        public void Init()
        {
            _testContext = new Bunit.TestContext();

            var logger  = new Mock <ILogger <DebounceTextArea> >();
            var logger2 = new Mock <ILogger <AdvancedTimer> >();

            _testContext.Services.Add(new ServiceDescriptor(typeof(ILogger <DebounceTextArea>), logger.Object));
            _testContext.Services.Add(new ServiceDescriptor(typeof(ILogger <AdvancedTimer>), logger2.Object));
        }
Пример #28
0
        public void MudHighlighterMarkupWithRegexTextTest()
        {
            using var ctx = new Bunit.TestContext();
            var text            = Parameter(nameof(MudHighlighter.Text), TEXT);
            var highlightedText = Parameter(nameof(MudHighlighter.HighlightedText), "[");

            var comp = ctx.RenderComponent <MudHighlighter>(text, highlightedText);

            comp.MarkupMatches("This is the first item");
        }
Пример #29
0
        public void CreateComponent()
        {
            MockAccountService.Delay = 0;
            _context = new TestContext();
            _context.Services.AddSingleton <IAccountService, MockAccountService>();
            _context.Services.AddScoped(typeof(ILogger <>), typeof(NullLogger <>));

            _accountService    = _context.Services.GetService <IAccountService>();
            _renderedComponent = CreateSut(_context);
        }
Пример #30
0
        public void WhenPageLoads_ThenErrorNotVisible()
        {
            using var ctx = new Bunit.TestContext();

            var cut = ctx.RenderComponent <VersionFinder>();

            var markup = cut.Markup;

            Assert.IsFalse(markup.Contains("The entered version was invalid. Please enter versions in the format {major}.{minor}.{patch} using only whole numbers and periods."));
        }