Ejemplo n.º 1
0
        public async Task Should_be_able_to_update_individual_participant()
        {
            var editPrefix    = " _Edit";
            var seededHearing = await Hooks.SeedVideoHearing();

            var beforeUpdatedDate = seededHearing.UpdatedDate;

            TestContext.WriteLine($"New seeded video hearing id: {seededHearing.Id}");
            _newHearingId = seededHearing.Id;
            var individualParticipant = seededHearing.GetParticipants().First(x => x.HearingRole.UserRole.Name.Equals("Individual"));

            var title            = individualParticipant.Person.Title + editPrefix;
            var displayName      = individualParticipant.DisplayName + editPrefix;
            var telephoneNumber  = "11112222333";
            var organisationName = "Organisation" + editPrefix;

            var updateParticipantCommand = new UpdateParticipantCommand(_newHearingId, individualParticipant.Id, title, displayName, telephoneNumber, organisationName, null, null);
            await _commandHandler.Handle(updateParticipantCommand);

            var updatedIndividual = (Individual)updateParticipantCommand.UpdatedParticipant;

            updatedIndividual.Should().NotBeNull();
            updatedIndividual.UpdatedDate.Should().BeAfter(beforeUpdatedDate);
            updatedIndividual.Person.Title.Should().Be(title);
            updatedIndividual.DisplayName.Should().Be(displayName);
            updatedIndividual.Person.TelephoneNumber.Should().Be(telephoneNumber);
        }
        public async Task Should_be_able_to_update_individual_participant()
        {
            var editPrefix    = " _Edit";
            var seededHearing = await Hooks.SeedVideoHearing();

            var beforeUpdatedDate = seededHearing.UpdatedDate;

            TestContext.WriteLine($"New seeded video hearing id: {seededHearing.Id}");
            _newHearingId = seededHearing.Id;
            var individualParticipant = seededHearing.GetParticipants().SingleOrDefault(x => x.HearingRole.UserRole.Name.Equals("Individual"));

            var        title            = individualParticipant.Person.Title + editPrefix;
            var        displayName      = individualParticipant.DisplayName + editPrefix;
            var        telephoneNumber  = "11112222333";
            var        houseNumber      = individualParticipant.Person.Address?.HouseNumber + editPrefix;
            var        street           = individualParticipant.Person.Address?.Street + editPrefix;
            var        postcode         = individualParticipant.Person.Address?.Postcode + editPrefix;
            var        city             = "City" + editPrefix;
            var        county           = "County" + editPrefix;
            var        organisationName = "Organisation" + editPrefix;
            NewAddress address          = new NewAddress()
            {
                HouseNumber = houseNumber,
                Street      = street,
                City        = city,
                County      = county,
                Postcode    = postcode
            };

            var updateParticipantCommand = new UpdateParticipantCommand(individualParticipant.Id, title, displayName, telephoneNumber, address, organisationName, seededHearing, null);
            await _commandHandler.Handle(updateParticipantCommand);

            var updatedIndividual = (Individual)updateParticipantCommand.UpdatedParticipant;

            updatedIndividual.Should().NotBeNull();
            updatedIndividual.UpdatedDate.Should().BeAfter(beforeUpdatedDate);
            updatedIndividual.Person.Title.Should().Be(title);
            updatedIndividual.DisplayName.Should().Be(displayName);
            updatedIndividual.Person.TelephoneNumber.Should().Be(telephoneNumber);
            updatedIndividual.Person.Address.HouseNumber.Should().Be(houseNumber);
            updatedIndividual.Person.Address.Street.Should().Be(street);
            updatedIndividual.Person.Address.Postcode.Should().Be(postcode);
        }