Exemple #1
0
        public void DisconnectTest()
        {
            var cameraMock = new Mock <IExtendedCamera>();

            var connectedState = new CameraConnectedState(cameraMock.Object, It.IsAny <IProxyFactory>());

            connectedState.Disconnect();

            cameraMock.VerifySet(x => x.StateObject = It.Is <ICameraState>(y => y.GetType() == typeof(CameraNotConnectedState)));
        }
Exemple #2
0
 public void StopStreaming()
 {
     try
     {
         var connectedState = new CameraConnectedState(It.IsAny <IExtendedCamera>(), It.IsAny <IProxyFactory>());
         connectedState.StopStreaming();
     }
     catch (Exception e)
     {
         Assert.AreEqual(typeof(IncorrectCameraStateException), e.GetType());
     }
 }
Exemple #3
0
        public void StartStreamingTest()
        {
            var cameraMock       = new Mock <IExtendedCamera>();
            var proxyFactoryMock = new Mock <IProxyFactory>();
            var mediaClientMock  = new Mock <Media>();

            mediaClientMock.Setup(x => x.GetStreamUriAsync(It.IsAny <StreamSetup>(), It.IsAny <string>()))
            .ReturnsAsync(new MediaUri()
            {
                Uri = "rtsp://test.com"
            });
            proxyFactoryMock.Setup(x => x.Create <Media, MediaClient>(It.IsAny <Uri>()))
            .Returns(() => mediaClientMock.Object);
            cameraMock.Setup(x => x.ConnectionUser).Returns(new CameraUser("test", "test"));

            var connectedState = new CameraConnectedState(cameraMock.Object, proxyFactoryMock.Object);

            connectedState.StartStreaming(new Profile()
            {
                token = "192.168.0.1"
            }, 10);

            cameraMock.VerifySet(x => x.StateObject = It.Is <ICameraState>(y => y.GetType() == typeof(CameraStreamingState)));
        }