コード例 #1
0
        public void Test010()
        {
            var renderSub = new ConcurrentRenderEventSubscriber(Renderer.RenderEvents);
            var wrapper   = RenderComponent <TwoComponentWrapper>(
                RenderFragment <Simple1>(nameof(TwoComponentWrapper.First)),
                RenderFragment <Simple1>(nameof(TwoComponentWrapper.Second))
                );
            var cuts       = wrapper.FindComponents <Simple1>();
            var wrapperSub = new ConcurrentRenderEventSubscriber(wrapper.RenderEvents);
            var cutSub1    = new ConcurrentRenderEventSubscriber(cuts[0].RenderEvents);
            var cutSub2    = new ConcurrentRenderEventSubscriber(cuts[1].RenderEvents);

            renderSub.RenderCount.ShouldBe(1);

            cuts[0].Render();

            renderSub.RenderCount.ShouldBe(2);
            wrapperSub.RenderCount.ShouldBe(1);
            cutSub1.RenderCount.ShouldBe(1);
            cutSub2.RenderCount.ShouldBe(0);

            cuts[1].Render();

            renderSub.RenderCount.ShouldBe(3);
            wrapperSub.RenderCount.ShouldBe(2);
            cutSub1.RenderCount.ShouldBe(1);
            cutSub2.RenderCount.ShouldBe(1);
        }
コード例 #2
0
ファイル: TestRendererTest.cs プロジェクト: vanderstack/bunit
        public void Test001()
        {
            var res = new ConcurrentRenderEventSubscriber(Renderer.RenderEvents);
            var sut = RenderComponent <TwoChildren>();

            res.RenderCount.ShouldBe(1);

            sut.Find("button").Click();

            res.RenderCount.ShouldBe(2);
        }