コード例 #1
0
        public void ShouldFireMediatorEventEachTimeWhenLanguageChanged()
        {
            // =====================================
            // Hint for css selector

            /*
             * By.css('.classname')          // get by class name
             * By.css('input[type=radio]')   // get input by type radio
             * By.css('.parent .child')      // get child who has a parent
             */

            // Take a look at the component text
            // var html = _component.Markup;

            // =====================================

            // All 3 languages in a RadzenSplitButton
            var elements = _component.FindAll(".rz-menuitem");

            elements.Should().NotBeNull();
            elements.Count.Should().Be(3);

            string[] expectedLanguages = { "en-US", "ru-RU", "de-DE" };
            for (int i = 0; i < 3; i++)
            {
                elements[i].Click();
                MediatorMock.Verify(m => m.Publish(
                                        It.Is <ChangeCurrentCultureMessage>(m => m.CultureName == expectedLanguages[0]),
                                        It.IsAny <CancellationToken>()), Times.Once);
            }
        }
コード例 #2
0
        public void ShouldFireLoginMediatorEventWhenElementClicked(ComponentType componentType)
        {
            var targetElement = componentType switch
            {
                ComponentType.NavMenu => _navMenuElements[1],
                ComponentType.Index => _indexButtons[0],
                _ => throw new ArgumentOutOfRangeException(nameof(componentType), componentType, null)
            };

            targetElement.Click();

            MediatorMock.Verify(m => m.Publish(It.IsAny <LoginToWgMessage>(), It.IsAny <CancellationToken>()), Times.Once);
        }
コード例 #3
0
        public void ShouldFireOpenClansSearchMediatorEventWhenElementClicked(ComponentType componentType)
        {
            var targetElement = componentType switch
            {
                ComponentType.NavMenu => _navMenuElements[3],
                ComponentType.Index => _indexButtons[2],
                _ => throw new ArgumentOutOfRangeException(nameof(componentType), componentType, null)
            };

            targetElement.Click();

            MediatorMock.Verify(m => m.Publish(
                                    It.Is <OpenSearchDialogMessage>(m => m.Type == DialogType.FindClan),
                                    It.IsAny <CancellationToken>()), Times.Once);
        }
    }