Пример #1
0
        public async Task UpdateState_ShouldUpdateState()
        {
            // Arrange
            var service = new ConnectionStateService(_serviceProviderMock.Object);

            // Act
            await service.UpdateState(ConnectionState.ConnectionLost);

            // Assert
            service.GetState().Should().Be(ConnectionState.ConnectionLost);
        }
Пример #2
0
        public void GetDownloadProgressInPercent_AfterConstruction_ShouldBeZero()
        {
            // Arrange
            var service = new ConnectionStateService(_serviceProviderMock.Object);

            // Act
            int downloadProgressInPercent = service.GetDownloadProgressInPercent();

            // Assert
            downloadProgressInPercent.Should().Be(0);
        }
Пример #3
0
        public void GetState_AfterConstruction_ShouldBeUnknown()
        {
            // Arrange
            var service = new ConnectionStateService(_serviceProviderMock.Object);

            // Act
            ConnectionState state = service.GetState();

            // Assert
            state.Should().Be(ConnectionState.Unknown);
        }
Пример #4
0
        public async Task UpdateStateAndDownloadProgress_ShouldNotifyWebClients()
        {
            // Arrange
            var service = new ConnectionStateService(_serviceProviderMock.Object);

            // Act
            await service.UpdateStateAndDownloadProgress(ConnectionState.Downloading, 12);

            // Assert
            _clientProxyMock.Verify(x => x.SendCoreAsync("Changed", It.IsAny <object[]>(), It.IsAny <CancellationToken>()), Times.Once);
        }
Пример #5
0
        public async Task UpdateStateAndDownloadProgress_ShouldUpdateStateAndDownloadProgress()
        {
            // Arrange
            var service = new ConnectionStateService(_serviceProviderMock.Object);

            // Act
            await service.UpdateStateAndDownloadProgress(ConnectionState.Downloading, 12);

            // Assert
            service.GetState().Should().Be(ConnectionState.Downloading);
            service.GetDownloadProgressInPercent().Should().Be(12);
        }
Пример #6
0
 public void Start()
 {
     connectionSateService = this.GetComponent <ConnectionStateService>();
     Toolkit.singleton.RegisterServiceConsumer(this, "RosMsgForwardService");
     Toolkit.singleton.RegisterServiceOfferer(connectionSateService);
 }