Exemplo n.º 1
0
 public void Should_Have_Validation_Error_If_Project_Is_Completed()
 {
     _arpaContext.EntityExistsAsync <Project>(Arg.Any <Guid>(), Arg.Any <CancellationToken>()).Returns(true);
     _arpaContext.EntityExistsAsync <MusicianProfile>(Arg.Any <Guid>(), Arg.Any <CancellationToken>()).Returns(true);
     _arpaContext.EntityExistsAsync <SelectValueMapping>(Arg.Any <Guid>(), Arg.Any <CancellationToken>()).Returns(true);
     _arpaContext.FindAsync <Project>(Arg.Any <object[]>(), Arg.Any <CancellationToken>()).Returns(ProjectSeedData.RockingXMas);
     _arpaContext.FindAsync <MusicianProfile>(Arg.Any <object[]>(), Arg.Any <CancellationToken>()).Returns(MusicianProfileSeedData.AdminMusicianProfile1);
     _validator.ShouldHaveValidationErrorFor(c => c.ProjectId, Guid.Empty)
     .WithErrorMessage("The project is completed. You may not set the participation of a completed project");
 }
Exemplo n.º 2
0
        public void Should_Have_Validation_Error_If_Completed_ProjectId_Is_Supplied()
        {
            _arpaContext.EntityExistsAsync <Person>(Arg.Any <Guid>(), Arg.Any <CancellationToken>()).Returns(true);
            _arpaContext.EntityExistsAsync <Project>(Arg.Any <Guid>(), Arg.Any <CancellationToken>()).Returns(true);
            Project project = ProjectSeedData.HoorayForHollywood;

            project.SetProperty(nameof(Project.IsCompleted), true);
            _arpaContext.FindAsync <Project>(Arg.Any <object[]>(), Arg.Any <CancellationToken>()).Returns(project);
            _validator.ShouldHaveValidationErrorFor(command => command.ProjectId, Guid.NewGuid())
            .WithErrorMessage("The project is completed. You may not set the participation of a completed project");
        }