예제 #1
0
        public void Should_ReturnTwoErrors_When_Analyst_AndDonor_DoNotExist()
        {
            var validator = new CanCreateProject(mockUnitOfWork.Object);

            mockUnitOfWork
            .Setup(x => x.CreateRepository())
            .Returns(mockRepository.Object);

            var results = validator.Validate(fakeCommand);

            results.Should().HaveCount(2)
            .And.ContainSingle(x => x.Name == "Donor")
            .And.ContainSingle(x => x.Name == "Analyst");
        }
예제 #2
0
        public void Should_ReturnError_When_Analyst_DoesNotExist()
        {
            var validator = new CanCreateProject(mockUnitOfWork.Object);

            mockRepository
            .Setup(x => x.Get <DonorAggregate>())
            .Returns(new[] { fakeDonor }.AsQueryable());
            mockUnitOfWork
            .Setup(x => x.CreateRepository())
            .Returns(mockRepository.Object);

            var results = validator.Validate(fakeCommand);

            results.Should().HaveCount(1)
            .And.ContainSingle(x => x.Name == "Analyst");
        }
예제 #3
0
        public void Should_NotReturnError_When_Analyst_AndDonor_Exist()
        {
            var validator = new CanCreateProject(mockUnitOfWork.Object);

            mockRepository
            .Setup(x => x.Get <Analyst>())
            .Returns(new[] { fakeAnalyst }.AsQueryable());
            mockRepository
            .Setup(x => x.Get <DonorAggregate>())
            .Returns(new[] { fakeDonor }.AsQueryable());
            mockUnitOfWork
            .Setup(x => x.CreateRepository())
            .Returns(mockRepository.Object);

            var results = validator.Validate(fakeCommand);

            results.Should().HaveCount(0);
        }