public void TestStreamingState() { var handler = CommandGenerator.CreateAutoCommandHandler <StreamingStatusSetCommand, StreamingStatusGetCommand>("IsStreaming", true); AtemMockServerWrapper.Each(_output, _pool, handler, DeviceTestCases.Streaming, helper => { var switcher = helper.SdkClient.SdkSwitcher as IBMDSwitcherStreamRTMP; Assert.NotNull(switcher); AtemState stateBefore = helper.Helper.BuildLibState(); for (int i = 0; i < 10; i++) { stateBefore.Streaming.Status.State = Randomiser.EnumValue <StreamingStatus>(); stateBefore.Streaming.Status.Error = Randomiser.EnumValue <StreamingError>(); var cmd = new StreamingStatusGetCommand { Status = stateBefore.Streaming.Status.State, Error = stateBefore.Streaming.Status.Error, }; helper.SendFromServerAndWaitForChange(stateBefore, cmd); } }); }
public void TestCacheUsed() { AtemMockServerWrapper.Each(_output, _pool, null, DeviceTestCases.Streaming, helper => { var switcher = helper.SdkClient.SdkSwitcher as IBMDSwitcherStreamRTMP; Assert.NotNull(switcher); AtemState stateBefore = helper.Helper.BuildLibState(); // Set streaming var streamCmd = new StreamingStatusGetCommand { Status = StreamingStatus.Streaming, Error = StreamingError.None }; stateBefore.Streaming.Status.State = StreamingStatus.Streaming; helper.SendFromServerAndWaitForChange(stateBefore, streamCmd); for (int i = 0; i < 5; i++) { var cmd = new StreamingStatsCommand { CacheUsed = (uint)Randomiser.RangeInt(0, 100) }; stateBefore.Streaming.Stats.CacheUsed = cmd.CacheUsed; helper.SendFromServerAndWaitForChange(stateBefore, cmd); } }); }
public void TestStopStreaming() { var handler = CommandGenerator.MatchCommand(new StreamingStatusSetCommand { IsStreaming = false }); AtemMockServerWrapper.Each(_output, _pool, handler, DeviceTestCases.Streaming, helper => { var switcher = helper.SdkClient.SdkSwitcher as IBMDSwitcherStreamRTMP; Assert.NotNull(switcher); // Set streaming var stateBefore = helper.Helper.BuildLibState(); var streamCmd = new StreamingStatusGetCommand { Status = StreamingStatus.Streaming, Error = StreamingError.None }; stateBefore.Streaming.Status.State = StreamingStatus.Streaming; helper.SendFromServerAndWaitForChange(stateBefore, streamCmd); for (int i = 0; i < 5; i++) { uint timeBefore = helper.Server.CurrentTime; helper.SendAndWaitForChange(null, () => { switcher.StopStreaming(); }); // It should have sent a response, but we dont expect any comparable data Assert.NotEqual(timeBefore, helper.Server.CurrentTime); } }); }