Ejemplo n.º 1
0
        public async Task ShouldUpdateSupplierStatus()
        {
            await CatalogueItemEntityBuilder
            .Create()
            .WithCatalogueItemId(_solution1Id)
            .WithName(_solution1Id)
            .WithPublishedStatusId((int)PublishedStatus.Published)
            .WithSupplierId(_supplierId)
            .Build()
            .InsertAsync();

            await SolutionEntityBuilder.Create()
            .WithId(_solution1Id)
            .WithOnLastUpdated(_lastUpdated)
            .Build()
            .InsertAsync();

            var mockUpdateSolutionSupplierStatusRequest = new Mock <IUpdateSolutionSupplierStatusRequest>();

            mockUpdateSolutionSupplierStatusRequest.Setup(m => m.Id).Returns(_solution1Id);
            mockUpdateSolutionSupplierStatusRequest.Setup(m => m.SupplierStatusId).Returns(2);

            _solutionRepository.CheckExists(_solution1Id, new CancellationToken()).Result.Should().BeTrue();

            await _solutionRepository.UpdateSupplierStatusAsync(mockUpdateSolutionSupplierStatusRequest.Object, new CancellationToken());

            var solution = await SolutionEntity.GetByIdAsync(_solution1Id);

            solution.Id.Should().Be(_solution1Id);

            (await solution.LastUpdated.SecondsFromNow()).Should().BeLessOrEqualTo(5);
        }
Ejemplo n.º 2
0
        public async Task ShouldUpdateSupplierStatus()
        {
            await SolutionEntityBuilder.Create()
            .WithName("Solution1")
            .WithId(_solution1Id)
            .WithOnLastUpdated(_lastUpdated)
            .WithOrganisationId(_org1Id)
            .WithSupplierId(_supplierId)
            .WithSupplierStatusId(1)
            .Build()
            .InsertAsync()
            .ConfigureAwait(false);

            var mockUpdateSolutionSupplierStatusRequest = new Mock <IUpdateSolutionSupplierStatusRequest>();

            mockUpdateSolutionSupplierStatusRequest.Setup(m => m.Id).Returns(_solution1Id);
            mockUpdateSolutionSupplierStatusRequest.Setup(m => m.SupplierStatusId).Returns(2);

            _solutionRepository.CheckExists(_solution1Id, new CancellationToken()).Result.Should().BeTrue();

            await _solutionRepository.UpdateSupplierStatusAsync(mockUpdateSolutionSupplierStatusRequest.Object, new CancellationToken()).ConfigureAwait(false);

            var solution = await SolutionEntity.GetByIdAsync(_solution1Id)
                           .ConfigureAwait(false);

            solution.Id.Should().Be(_solution1Id);

            (await solution.LastUpdated.SecondsFromNow().ConfigureAwait(false)).Should().BeLessOrEqualTo(5);

            solution.SupplierStatusId.Should().Be(2);
        }
Ejemplo n.º 3
0
 public void SolutionIdDoesNotExist()
 {
     solutionRepository.CheckExists(Solution1Id, CancellationToken.None).Result.Should().BeFalse();
 }