public void HubInvocationProgressSendsProgressThenThrowsOnceSetAsComplete()
        {
            // Arrange
            var receivedProgressValue = -1;
            var sendProgressFunc      = new Func <object, Task>(value =>
            {
                receivedProgressValue = (int)value;
                return(Task.FromResult(true));
            });
            var progress = new HubInvocationProgress <int>(sendProgressFunc);

            // Act
            progress.Report(100);
            progress.SetComplete();

            // Assert
            Assert.Equal(100, receivedProgressValue);
            Assert.Throws <InvalidOperationException>(() => progress.Report(100));
        }
        public void HubInvocationProgressSendsProgressThenThrowsOnceSetAsComplete()
        {
            // Arrange
            var receivedProgressValue = -1;
            var sendProgressFunc = new Func<object, Task>(value =>
            {
                receivedProgressValue = (int)value;
                return Task.FromResult(true);
            });
            var progress = new HubInvocationProgress<int>(sendProgressFunc);

            // Act
            progress.Report(100);
            progress.SetComplete();

            // Assert
            Assert.Equal(100, receivedProgressValue);
            Assert.Throws<InvalidOperationException>(() => progress.Report(100));
        }
        public void HubInvocationThrowsOnceSetAsComplete()
        {
            // Arrange
            var sendProgressFunc = new Func <object, Task>(value => Task.FromResult(true));
            var progress         = new HubInvocationProgress <int>(sendProgressFunc);

            // Act
            progress.SetComplete();

            // Assert
            Assert.Throws <InvalidOperationException>(() => progress.Report(100));
        }
        public void HubInvocationThrowsOnceSetAsComplete()
        {
            // Arrange
            var sendProgressFunc = new Func<object, Task>(value => Task.FromResult(true));
            var progress = new HubInvocationProgress<int>(sendProgressFunc);

            // Act
            progress.SetComplete();

            // Assert
            Assert.Throws<InvalidOperationException>(() => progress.Report(100));
        }
        public void HubInvocationProgressSendsProgressValuesViaSendProgressFunc()
        {
            // Arrange
            var result           = -1;
            var sendProgressFunc = new Func <object, Task>(value =>
            {
                result = (int)value;
                return(Task.FromResult(true));
            });
            var progress = new HubInvocationProgress <int>(sendProgressFunc);

            // Act
            progress.Report(100);

            // Assert
            Assert.Equal(100, result);
        }
        public void HubInvocationProgressSendsProgressValuesViaSendProgressFunc()
        {
            // Arrange
            var result = -1;
            var sendProgressFunc = new Func<object, Task>(value =>
            {
                result = (int)value;
                return Task.FromResult(true);
            });
            var progress = new HubInvocationProgress<int>(sendProgressFunc);

            // Act
            progress.Report(100);

            // Assert
            Assert.Equal(100, result);
        }