Ejemplo n.º 1
0
        public async Task ThrowInvalidOperationException_When_MoreThanOneTestRunExistForProvidedTestRunId_AndStatus(TestRunStatus status)
        {
            // Arrange
            var testRuns = TestRunFactory.CreateMany(_testRunId);

            _testRunRepositoryMock.Setup(x => x.GetAllAsync()).Returns(Task.FromResult(testRuns));

            // Act
            var action = new TestDelegate(() => _testRunProvider.CompleteTestRunAsync(_testRunId, status));

            // Assert
            Assert.That(action, Throws.Exception.TypeOf <InvalidOperationException>());
        }
Ejemplo n.º 2
0
        public async Task ShouldUpdateTestRunStatusToProvidedValue_When_OneTestRunExistForProvidedTestRunId_AndOtherTestRunsExists_AndStatus(TestRunStatus status)
        {
            // Arrange
            var currentTestRun = TestRunFactory.CreateSingleInProgress(_testRunId);
            var otherTestRuns  = TestRunFactory.CreateMany();

            _testRunRepositoryMock.Setup(x => x.GetAllAsync()).Returns(Task.FromResult(currentTestRun.Union(otherTestRuns)));

            // Act
            _testRunProvider.CompleteTestRunAsync(_testRunId, status);

            // Assert
            _testRunRepositoryMock.Verify(x => x.UpdateAsync(It.IsAny <int>(), It.Is <TestRunDto>(i => i.TestRunId == _testRunId && i.Status == status)), Times.Once);
            _testRunRepositoryMock.Verify(x => x.UpdateAsync(It.IsAny <int>(), It.IsAny <TestRunDto>()), Times.Once);
        }