コード例 #1
0
        public void TestClipSetValid()
        {
            AtemMockServerWrapper.Each(_output, _pool, SetValidCommandHandler, DeviceTestCases.MediaPlayerClips, helper =>
            {
                for (int i = 0; i < 3; i++)
                {
                    AtemState stateBefore = helper.Helper.BuildLibState();
                    uint index            = Randomiser.RangeInt((uint)stateBefore.MediaPool.Clips.Count);
                    IBMDSwitcherClip clip = GetClip(helper, index);

                    string name     = Guid.NewGuid().ToString();
                    uint frameCount = Randomiser.RangeInt(5) + 3;

                    var cb = new LockCallback();
                    helper.SendAndWaitForChange(stateBefore, () => { clip.Lock(cb); });
                    Assert.True(cb.Wait.WaitOne(2000));

                    var clipState        = stateBefore.MediaPool.Clips[(int)index];
                    clipState.IsUsed     = true;
                    clipState.Name       = name;
                    clipState.FrameCount = frameCount;

                    helper.SendAndWaitForChange(stateBefore, () =>
                    {
                        clip.SetValid(name, frameCount);
                    });

                    helper.SendAndWaitForChange(stateBefore, () =>
                    {
                        clip.Unlock(cb);
                    });
                }
            });
        }