コード例 #1
0
ファイル: TriggerEventTest.cs プロジェクト: zlinst/UniTask
            public void Run1()
            {
                TestEvent one   = default;
                TestEvent two   = default;
                TestEvent three = default;
                TestEvent four  = default;

                one = new TestEvent(1, () =>
                {
                    if (two == null)
                    {
                        ev.Add(two = new TestEvent(2));
                    }
                    else if (three == null)
                    {
                        ev.Add(three = new TestEvent(3));
                    }
                    else if (four == null)
                    {
                        ev.Add(four = new TestEvent(4));
                    }
                });

                ev.Add(one);

                ev.SetResult(10);
                ev.SetResult(20);
                ev.SetResult(30);
                ev.SetResult(40);

                one.NextCalled.Should().BeEquivalentTo(10, 20, 30, 40);
                two.NextCalled.Should().BeEquivalentTo(20, 30, 40);
                three.NextCalled.Should().BeEquivalentTo(30, 40);
                four.NextCalled.Should().BeEquivalentTo(40);
            }
コード例 #2
0
ファイル: TriggerEventTest.cs プロジェクト: zlinst/UniTask
            public void Run1()
            {
                TestEvent one   = default;
                TestEvent two   = default;
                TestEvent three = default;
                TestEvent four  = default;

                one   = new TestEvent(1, () => { ev.Remove(two); ev.Remove(three); });
                two   = new TestEvent(2);
                three = new TestEvent(3);
                four  = new TestEvent(4);

                ev.Add(one);
                ev.Add(two);
                ev.Add(three);
                ev.Add(four);

                ev.SetResult(10);
                ev.SetResult(20);
                ev.SetResult(30);

                one.NextCalled.Should().BeEquivalentTo(10, 20, 30);
                two.NextCalled.Count.Should().Be(0);
                three.NextCalled.Count.Should().Be(0);
                four.NextCalled.Should().BeEquivalentTo(10, 20, 30);
            }
コード例 #3
0
ファイル: TriggerEventTest.cs プロジェクト: zlinst/UniTask
            public void Run1()
            {
                TestEvent one = default;

                one = new TestEvent(1, () => ev.Remove(one));

                var two   = new TestEvent(2);
                var three = new TestEvent(3);

                ev.Add(one);
                ev.Add(two);
                ev.Add(three);

                ev.SetResult(10);
                ev.SetResult(20);
                ev.SetResult(30);

                one.NextCalled.Should().BeEquivalentTo(10);
                two.NextCalled.Should().BeEquivalentTo(10, 20, 30);
                three.NextCalled.Should().BeEquivalentTo(10, 20, 30);
            }
コード例 #4
0
            public void Run1()
            {
                TestEvent one   = default;
                TestEvent two   = default;
                TestEvent three = default;

                one   = new TestEvent(1, () => ev.Remove(two));
                two   = new TestEvent(2);
                three = new TestEvent(3);

                ev.Add(one);
                ev.Add(two);
                ev.Add(three);

                ev.SetResult(10);
                ev.SetResult(20);
                ev.SetResult(30);

                one.NextCalled.Should().Equal(10, 20, 30);
                two.NextCalled.Count.Should().Be(0);
                three.NextCalled.Should().Equal(10, 20, 30);
            }