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); }
public void GetDownloadProgressInPercent_AfterConstruction_ShouldBeZero() { // Arrange var service = new ConnectionStateService(_serviceProviderMock.Object); // Act int downloadProgressInPercent = service.GetDownloadProgressInPercent(); // Assert downloadProgressInPercent.Should().Be(0); }
public void GetState_AfterConstruction_ShouldBeUnknown() { // Arrange var service = new ConnectionStateService(_serviceProviderMock.Object); // Act ConnectionState state = service.GetState(); // Assert state.Should().Be(ConnectionState.Unknown); }
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); }
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); }
public void Start() { connectionSateService = this.GetComponent <ConnectionStateService>(); Toolkit.singleton.RegisterServiceConsumer(this, "RosMsgForwardService"); Toolkit.singleton.RegisterServiceOfferer(connectionSateService); }