public async Task HasOtherStepWithAutoTransferMethodAsync_ShouldReturnFalse_WhenSameStepHasSameAutoTransferMethod() { int stepId; var autoTransferMethod = AutoTransferMethod.OnRfccSign; using (var context = new PreservationContext(_dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider)) { var journey = context.Journeys.Single(j => j.Id == _journey1WithStepId); var step = new Step(TestPlant, "S2", AddMode(context, "M2", false), AddResponsible(context, "R2")) { AutoTransferMethod = autoTransferMethod }; journey.AddStep(step); context.SaveChangesAsync().Wait(); stepId = step.Id; } using (var context = new PreservationContext(_dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider)) { var dut = new JourneyValidator(context); var result = await dut.HasOtherStepWithAutoTransferMethodAsync(_journey1WithStepId, stepId, autoTransferMethod, default); Assert.IsFalse(result); } }
public async Task ExistsStepAsync_UnknownJourneyId_ShouldReturnFalse() { using (var context = new PreservationContext(_dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider)) { var dut = new JourneyValidator(context); var result = await dut.ExistsStepAsync(126234, _step1InJourney1.Id, default); Assert.IsFalse(result); } }
public async Task ExistsStepAsync_KnownIds_ShouldReturnTrue() { using (var context = new PreservationContext(_dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider)) { var dut = new JourneyValidator(context); var result = await dut.ExistsStepAsync(_journey1WithStepId, _step1InJourney1.Id, default); Assert.IsTrue(result); } }
public async Task OtherStepExistsWithSameTitleAsync_SameTitleAsStepInAnotherJourney_ShouldReturnFalse() { using (var context = new PreservationContext(_dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider)) { var dut = new JourneyValidator(context); var result = await dut.OtherStepExistsWithSameTitleAsync(_journey1WithStepId, _step1InJourney1.Id, StepTitle1InJourney2, default); Assert.IsFalse(result); } }
public async Task HasOtherStepWithAutoTransferMethodAsync_UnknownJourney_ShouldReturnFalse() { using (var context = new PreservationContext(_dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider)) { var dut = new JourneyValidator(context); var result = await dut.HasOtherStepWithAutoTransferMethodAsync(1267, 0, AutoTransferMethod.OnRfccSign, default); Assert.IsFalse(result); } }
public async Task IsAnyStepInJourneyInUseAsync_ShouldReturnFalse_BeforeTagAddedToAStep() { using (var context = new PreservationContext(_dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider)) { var dut = new JourneyValidator(context); var result = await dut.IsAnyStepInJourneyInUseAsync(_journey1WithStepId, default); Assert.IsFalse(result); } }
public async Task ExistsWithDuplicateTitleAsync_UnknownKnownId_ShouldReturnFalse() { using (var context = new PreservationContext(_dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider)) { var dut = new JourneyValidator(context); var result = await dut.ExistsWithDuplicateTitleAsync(92982, default); Assert.IsFalse(result); } }
public async Task IsInUseAsync_NoSteps_ShouldReturnFalse() { using (var context = new PreservationContext(_dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider)) { var dut = new JourneyValidator(context); var result = await dut.IsInUseAsync(_journeyWithoutStepId, default); Assert.IsFalse(result); } }
public async Task HasAnyStepsAsync_JorneyWithSteps_ShouldReturnTrue() { using (var context = new PreservationContext(_dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider)) { var dut = new JourneyValidator(context); var result = await dut.HasAnyStepsAsync(_journey1WithStepId, default); Assert.IsTrue(result); } }
public async Task ExistsWithSameTitleInAnotherJourneyAsync_NewTitle_ShouldReturnFalse() { using (var context = new PreservationContext(_dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider)) { var dut = new JourneyValidator(context); var result = await dut.ExistsWithSameTitleInAnotherJourneyAsync(_journey1WithStepId, "XXXXXX", default); Assert.IsFalse(result); } }
public async Task IsVoidedAsync_KnownVoided_ShouldReturnTrue() { using (var context = new PreservationContext(_dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider)) { var journey = context.Journeys.Single(j => j.Id == _journey1WithStepId); journey.IsVoided = true; context.SaveChangesAsync().Wait(); } using (var context = new PreservationContext(_dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider)) { var dut = new JourneyValidator(context); var result = await dut.IsVoidedAsync(_journey1WithStepId, default); Assert.IsTrue(result); } }
public async Task IsAnyStepInJourneyInUseAsync_ShouldReturnTrue_AfterTagAddedToAStep() { using (var context = new PreservationContext(_dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider)) { var project = AddProject(context, "P", "Project description"); var rd = AddRequirementTypeWith1DefWithoutField(context, "Rot", "D", RequirementTypeIcon.Other).RequirementDefinitions.First(); AddTag(context, project, TagType.Standard, "TagNo", "Tag description", _step1InJourney1, new List <TagRequirement> { new TagRequirement(TestPlant, 2, rd) }); } using (var context = new PreservationContext(_dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider)) { var dut = new JourneyValidator(context); var result = await dut.IsAnyStepInJourneyInUseAsync(_journey1WithStepId, default); Assert.IsTrue(result); } }