public void Setup() { //orgranisation table setup organisation = new Organisation("strawhat"); //persons record IndividualPerson = new Person("mr", "luffy", "dragon", "*****@*****.**") { ContactEmail = "*****@*****.**", Organisation = organisation }; JudgePerson = new Person("mr", "zoro", "rononora", "*****@*****.**") { ContactEmail = "*****@*****.**", Organisation = organisation }; JudicialOfficeHolderPerson = new Person("mr", "luffy", "dragon", "*****@*****.**") { ContactEmail = "*****@*****.**", Organisation = organisation }; StaffMemberPerson = new Person("mr", "luffy", "duffy", "*****@*****.**") { ContactEmail = "*****@*****.**", Organisation = organisation }; //participants record IndividualParticipant = new Individual(IndividualPerson, new HearingRole(123, "hearingrole"), new CaseRole(345, "caserole")) { Discriminator = "Individual" }; var IndividualParticipant2 = new Individual(IndividualPerson, new HearingRole(123, "hearingrole"), new CaseRole(345, "caserole")) { Discriminator = "Individual" }; JudgeParticipant = new Judge(JudgePerson, new HearingRole(123, "hearingrole"), new CaseRole(345, "caserole")) { Discriminator = "Judge" }; JudicialOfficeHolderParticipant = new JudicialOfficeHolder(JudicialOfficeHolderPerson, new HearingRole(123, "hearingrole"), new CaseRole(345, "caserole")) { Discriminator = "JudicialOfficeHolder" }; StaffMemberParticipant = new JudicialOfficeHolder(StaffMemberPerson, new HearingRole(719, "hearingrole"), new CaseRole(345, "caserole")) { Discriminator = "StaffMember" }; _context.Persons.AddRange(IndividualPerson, JudgePerson, JudicialOfficeHolderPerson, StaffMemberPerson); _context.Participants.AddRange(IndividualParticipant, IndividualParticipant2, JudgeParticipant, JudicialOfficeHolderParticipant, StaffMemberParticipant); _context.SaveChanges(); _configOptions.Setup(opt => opt.Value).Returns(new FeatureFlagConfiguration() { EJudFeature = true }); _handler = new GetPersonBySearchTermQueryHandler(_context, _configOptions.Object); }
public void Setup() { _configOptions = new Mock <IOptions <FeatureFlagConfiguration> >(); var context = new BookingsDbContext(BookingsDbContextOptions); _configOptions.Setup(opt => opt.Value).Returns(new FeatureFlagConfiguration() { StaffMemberFeature = true }); _handler = new GetPersonBySearchTermQueryHandler(context, _configOptions.Object); }
public async Task Handle_Should_Not_Filters_Out_Participant_With_Discriminator_Of_Judge_And_JudicialOfficeHolder() { _configOptions.Setup(opt => opt.Value).Returns(new FeatureFlagConfiguration() { EJudFeature = false }); _handler = new GetPersonBySearchTermQueryHandler(_context, _configOptions.Object); var persons = await _handler.Handle(new GetPersonBySearchTermQuery("luff")); Assert.AreEqual(3, persons.Count); persons.Select(m => m.Id).Should().Contain(IndividualPerson.Id); persons.Select(m => m.Id).Should().NotContain(JudgePerson.Id); persons.Select(m => m.Id).Should().Contain(JudicialOfficeHolderPerson.Id); }
public async Task Returns_Persons_Record_By_Search_Term_Ejud_OFF() { _configOptions.Setup(opt => opt.Value).Returns(new FeatureFlagConfiguration() { EJudFeature = false }); _handler = new GetPersonBySearchTermQueryHandler(_context, _configOptions.Object); var persons = await _handler.Handle(new GetPersonBySearchTermQuery("luff")); Assert.AreEqual(3, persons.Count); persons.Select(m => m.Id).Should().Contain(IndividualPerson.Id); persons.Select(m => m.Id).Should().Contain(JudicialOfficeHolderPerson.Id); persons.Select(m => m.Id).Should().NotContain(JudgePerson.Id); }
public void Setup() { var context = new BookingsDbContext(BookingsDbContextOptions); _handler = new GetPersonBySearchTermQueryHandler(context); }