Exemplo n.º 1
0
        public async Task Should_retrieve_all_messages_for_the_participant()
        {
            var conference = new ConferenceBuilder(true)
                             .WithParticipant(UserRole.Individual, "Claimant")
                             .WithParticipant(UserRole.Judge, "Judge")
                             .Build();

            var judge       = conference.GetParticipants().First(x => x.UserRole == UserRole.Judge);
            var participant = conference.GetParticipants().First(x => x.UserRole == UserRole.Individual);
            var vhOfficer   = "VH Officer";

            conference.AddInstantMessage(vhOfficer, "InstantMessage 1", judge.DisplayName);
            conference.AddInstantMessage(judge.DisplayName, "InstantMessage 2", vhOfficer);

            conference.AddInstantMessage(participant.Username, "Hello VHO", vhOfficer);
            conference.AddInstantMessage(vhOfficer, "Hello ParticipantOne", participant.Username);

            var seededConference = await TestDataManager.SeedConference(conference);

            _newConferenceId = seededConference.Id;

            var query   = new GetInstantMessagesForConferenceQuery(_newConferenceId, participant.Username);
            var results = await _handler.Handle(query);

            results.Count.Should().Be(conference.GetInstantMessageHistoryFor(participant.Username).Count);
            results.Should().BeInDescendingOrder(x => x.TimeStamp);
        }
        public void should_not_return_any_messages_for_the_a_participant_not_on_the_conference()
        {
            var nonExistentUser = "******";

            var conference = new ConferenceBuilder().Build();

            var from        = "sender display name";
            var messageText = "test message";
            var to          = "receiver display name";

            var beforeCount = conference.GetInstantMessageHistoryFor(nonExistentUser).Count;

            conference.AddInstantMessage(from, messageText, to);
            var messages   = conference.GetInstantMessageHistoryFor(nonExistentUser);
            var afterCount = messages.Count;

            afterCount.Should().Be(beforeCount);
        }
        public void should_get_all_messages_for_the_participant_for_the_conference()
        {
            var conference = new ConferenceBuilder().Build();

            var from        = "sender display name";
            var messageText = "test message";
            var to          = "receiver display name";

            var beforeCount = conference.GetInstantMessageHistoryFor(from).Count;

            conference.AddInstantMessage(from, messageText, to);

            var messages   = conference.GetInstantMessageHistoryFor(from);
            var afterCount = messages.Count;

            afterCount.Should().BeGreaterThan(beforeCount);
            var messageSaved = messages.First();

            messageSaved.From.Should().Be(from);
            messageSaved.MessageText.Should().Be(messageText);
        }