Ejemplo n.º 1
0
        public async Task Should_be_able_to_update_representative_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 representativeParticipant = seededHearing.GetParticipants().First(x => x.HearingRole.UserRole.Name.Equals("Representative"));

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

            var representee = "Iron Man Inc.";
            RepresentativeInformation repInfo = new RepresentativeInformation()
            {
                Representee = representee
            };
            var updateParticipantCommand = new UpdateParticipantCommand(_newHearingId, representativeParticipant.Id, title, displayName, telephoneNumber, organisationName, repInfo, null);
            await _commandHandler.Handle(updateParticipantCommand);

            var updatedRepresentative = (Representative)updateParticipantCommand.UpdatedParticipant;

            updatedRepresentative.Should().NotBeNull();
            updatedRepresentative.UpdatedDate.Should().BeAfter(beforeUpdatedDate);
            updatedRepresentative.Person.Title.Should().Be(title);
            updatedRepresentative.DisplayName.Should().Be(displayName);
            updatedRepresentative.Person.TelephoneNumber.Should().Be(telephoneNumber);
            updatedRepresentative.Person.Organisation.Should().NotBeNull();
            updatedRepresentative.Person.Organisation.Name.Should().Be(organisationName);
            updatedRepresentative.Representee.Should().Be(repInfo.Representee);
        }
        public async Task Should_be_able_to_update_representative_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 representativeParticipant = seededHearing.GetParticipants().FirstOrDefault(x => x.HearingRole.UserRole.Name.Equals("Representative"));

            var        title            = representativeParticipant.Person.Title + editPrefix;
            var        displayName      = representativeParticipant.DisplayName + editPrefix;
            var        telephoneNumber  = "11112222333";
            var        houseNumber      = "HouseNumber" + editPrefix;
            var        street           = "Street" + editPrefix;
            var        postcode         = "ED1 5NR";
            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
            };
            const string reference            = "Marvel Comics Division";
            var          representee          = "Iron Man Inc.";
            RepresentativeInformation repInfo = new RepresentativeInformation()
            {
                Reference   = reference,
                Representee = representee
            };
            var updateParticipantCommand = new UpdateParticipantCommand(representativeParticipant.Id, title, displayName, telephoneNumber, address, organisationName, seededHearing, repInfo);
            await _commandHandler.Handle(updateParticipantCommand);

            var updatedRepresentative = (Representative)updateParticipantCommand.UpdatedParticipant;

            updatedRepresentative.Should().NotBeNull();
            updatedRepresentative.UpdatedDate.Should().BeAfter(beforeUpdatedDate);
            updatedRepresentative.Person.Title.Should().Be(title);
            updatedRepresentative.DisplayName.Should().Be(displayName);
            updatedRepresentative.Person.TelephoneNumber.Should().Be(telephoneNumber);
            updatedRepresentative.Person.Address.Should().BeNull();
            updatedRepresentative.Person.Organisation.Should().NotBeNull();
            updatedRepresentative.Person.Organisation.Name.Should().Be(organisationName);
            updatedRepresentative.Reference.Should().Be(repInfo.Reference);
            updatedRepresentative.Representee.Should().Be(repInfo.Representee);
        }