Exemple #1
0
        public void AddNewGatheringTest_ChecksIfTheANewGatheringIsAddedAsExpectedToTheDatabase_VerifiesByTheReturnedValue()
        {
            // Get the repository to perform operations
            var gatheringRepository = _kernel.Get <IGatheringService>();

            Assert.IsNotNull(gatheringRepository);
            string   title          = "Painters Get Around";
            string   description    = "We painters are a different lot";
            DateTime dateOfMeeting  = DateTime.Now.AddDays(9).Date;
            string   organizerEmail = "*****@*****.**";
            string   topic          = Gathering.AllTopics()[0];
            Location location       = new Location(23.45M, 73.31M, "F-6, Islamabad, Pakistan");
            string   venue          = "Chaye Khana";
            bool     isVideoMeeting = false;
            string   videoCallLink  = null;

            var gathering = new Gathering.GatheringBuilder().Title(title).Description(description).DateOfMeeting(dateOfMeeting)
                            .OrganizerEmail(organizerEmail).Topic(topic).Location(location).Venue(venue)
                            .IsVideoGathering(isVideoMeeting).VideoCallLink(videoCallLink).Build();

            gatheringRepository.AddNewGathering(gathering);

            // Retrieve the Gathering
            var retrievedGathering = gatheringRepository.GetGatheringById(gathering.Id);

            Assert.IsNotNull(retrievedGathering);
            Assert.AreEqual(title, retrievedGathering.Title);
            Assert.AreEqual(description, retrievedGathering.Description);
            Assert.AreEqual(dateOfMeeting, retrievedGathering.DateOfMeeting);
            Assert.AreEqual(organizerEmail, retrievedGathering.OrganizerEmail);
            Assert.AreEqual(topic, retrievedGathering.Topic);
            Assert.IsNotNull(retrievedGathering.Location);
            Assert.AreEqual(location.Latitude, retrievedGathering.Location.Latitude);
            Assert.AreEqual(location.Longitude, retrievedGathering.Location.Longitude);
            Assert.AreEqual(location.Area, retrievedGathering.Location.Area);
            Assert.AreEqual(venue, retrievedGathering.Venue);
            Assert.AreEqual(isVideoMeeting, retrievedGathering.IsVideoGathering);
            Assert.AreEqual(videoCallLink, retrievedGathering.VideoCallLink);
        }
Exemple #2
0
        public void AddNewAttendeeTest_ChecksIfTheANewAttendeeIsAddedAsExpectedToTheDatabase_VerifiesByTheReturnedValue()
        {
            var gatheringService = _kernel.Get <IGatheringService>();

            Assert.IsNotNull(gatheringService);
            string   title          = "Painters Get Around";
            string   description    = "We painters are a different lot";
            DateTime dateOfMeeting  = DateTime.Now.AddDays(9).Date;
            string   organizerEmail = "*****@*****.**";
            string   topic          = Gathering.AllTopics()[0];
            Location location       = new Location(23.45M, 73.31M, "F-6, Islamabad, Pakistan");
            string   venue          = "Chaye Khana";
            bool     isVideoMeeting = false;
            string   videoCallLink  = null;

            var gathering = new Gathering.GatheringBuilder().Title(title).Description(description).DateOfMeeting(dateOfMeeting)
                            .OrganizerEmail(organizerEmail).Topic(topic).Location(location).Venue(venue)
                            .IsVideoGathering(isVideoMeeting).VideoCallLink(videoCallLink).Build();

            gatheringService.AddNewGathering(gathering);

            // Retrieve the Gathering
            var retrievedGathering = gatheringService.GetGatheringById(gathering.Id);

            Assert.IsNotNull(retrievedGathering);
            //Assert.AreEqual(0, retrievedGathering.AttendeesEmails.Count);

            string attendeeName1  = "Khaleesi";
            string attendeeEmail1 = "*****@*****.**";

            gatheringService.AddNewAttendee(gathering.Id, new Attendee(attendeeName1, attendeeEmail1));

            string attendeeName2  = "Jon Snow";
            string attendeeEmail2 = "*****@*****.**";

            gatheringService.AddNewAttendee(gathering.Id, new Attendee(attendeeName2, attendeeEmail2));

            string attendeeName3  = "Night King";
            string attendeeEmail3 = "*****@*****.**";

            gatheringService.AddNewAttendee(gathering.Id, new Attendee(attendeeName3, attendeeEmail3));

            string attendeeName4  = "Tormund";
            string attendeeEmail4 = "*****@*****.**";

            gatheringService.AddNewAttendee(gathering.Id, new Attendee(attendeeName4, attendeeEmail4));

            // Get the gathering again
            var retrievedGathering2 = gatheringService.GetAllGatheringByEmail(organizerEmail);

            Assert.IsNotNull(retrievedGathering2);
            Assert.AreEqual(4, retrievedGathering2[0].Attendees.Count);

            // Attendee # 1
            Assert.AreEqual(attendeeName1, retrievedGathering2[0].Attendees[0].FullName);
            Assert.AreEqual(attendeeEmail1, retrievedGathering2[0].Attendees[0].Email);

            // Attendee # 2
            Assert.AreEqual(attendeeName2, retrievedGathering2[0].Attendees[1].FullName);
            Assert.AreEqual(attendeeEmail2, retrievedGathering2[0].Attendees[1].Email);

            // Attendee # 3
            Assert.AreEqual(attendeeName3, retrievedGathering2[0].Attendees[2].FullName);
            Assert.AreEqual(attendeeEmail3, retrievedGathering2[0].Attendees[2].Email);

            // Attendee # 4
            Assert.AreEqual(attendeeName4, retrievedGathering2[0].Attendees[3].FullName);
            Assert.AreEqual(attendeeEmail4, retrievedGathering2[0].Attendees[3].Email);
        }
Exemple #3
0
        public void GetAllGatheringsByEmailTest_ChecksIfAllTheGatheringsStoredInTheDatabaseWithASpecificEmailAreRetrievedAsExpected_VerifiesByTheReturnedValue()
        {
            // Gathering # 1
            var gatheringService = _kernel.Get <IGatheringService>();

            Assert.IsNotNull(gatheringService);
            string   title          = "Painters Get Around";
            string   description    = "We painters are a different lot";
            DateTime dateOfMeeting  = DateTime.Now.AddDays(9).Date;
            string   organizerEmail = "*****@*****.**";
            string   topic          = Gathering.AllTopics()[0];
            Location location       = new Location(23.45M, 73.31M, "F-6, Islamabad, Pakistan");
            string   venue          = "Chaye Khana";
            bool     isVideoMeeting = false;
            string   videoCallLink  = null;

            var gathering = new Gathering.GatheringBuilder().Title(title).Description(description).DateOfMeeting(dateOfMeeting)
                            .OrganizerEmail(organizerEmail).Topic(topic).Location(location).Venue(venue)
                            .IsVideoGathering(isVideoMeeting).VideoCallLink(videoCallLink).Build();

            gatheringService.AddNewGathering(gathering);

            // Gathering # 2
            string   title2          = "Painters Get Around 2 ";
            string   description2    = "We painters are a different lot 2";
            DateTime dateOfMeeting2  = DateTime.Now.AddDays(10).Date;
            string   organizerEmail2 = "*****@*****.**";
            string   topic2          = Gathering.AllTopics()[1];
            Location location2       = new Location(23.41M, 73.39M, "F-7, Islamabad, Pakistan");
            string   venue2          = "Attrio Cafe";
            bool     isVideoMeeting2 = true;
            string   videoCallLink2  = "https://dummygooglemeet.com/12343767docvnwb20t585jhetycghwrffgffd";

            var gathering2 = new Gathering.GatheringBuilder().Title(title2).Description(description2)
                             .DateOfMeeting(dateOfMeeting2).OrganizerEmail(organizerEmail2).Topic(topic2).Location(location2)
                             .Venue(venue2).IsVideoGathering(isVideoMeeting2).VideoCallLink(videoCallLink2)
                             .Build();

            gatheringService.AddNewGathering(gathering2);

            // Gathering # 3
            string   title3          = "Painters Get Around 3";
            string   description3    = "We painters are a different lot 3";
            DateTime dateOfMeeting3  = DateTime.Now.AddDays(8).Date;
            string   organizerEmail3 = "*****@*****.**";
            string   topic3          = Gathering.AllTopics()[2];
            Location location3       = new Location(23.57M, 73.43M, "F-8, Islamabad, Pakistan");
            string   venue3          = "Pizza Hut";
            bool     isVideoMeeting3 = true;
            string   videoCallLink3  = "https://dummygooglemeet.com/12343767docvnwb20t585jhetycghwrf6654323d";

            var gathering3 = new Gathering.GatheringBuilder().Title(title3).Description(description3)
                             .DateOfMeeting(dateOfMeeting3).OrganizerEmail(organizerEmail3).Topic(topic3).Location(location3)
                             .Venue(venue3).IsVideoGathering(isVideoMeeting3).VideoCallLink(videoCallLink3)
                             .Build();

            gatheringService.AddNewGathering(gathering3);

            // Gathering # 4
            string   title4          = "Painters Get Around 4";
            string   description4    = "We painters are a different lot 4";
            DateTime dateOfMeeting4  = DateTime.Now.AddDays(12).Date;
            string   organizerEmail4 = "*****@*****.**";
            string   topic4          = Gathering.AllTopics()[3];
            Location location4       = new Location(23.97M, 73.73M, "F-9, Islamabad, Pakistan");
            string   venue4          = "Fatima Jinnah Park";
            bool     isVideoMeeting4 = false;
            string   videoCallLink4  = "";

            var gathering4 = new Gathering.GatheringBuilder().Title(title4).Description(description4)
                             .DateOfMeeting(dateOfMeeting4).OrganizerEmail(organizerEmail4).Topic(topic4).Location(location4)
                             .Venue(venue4).IsVideoGathering(isVideoMeeting4).VideoCallLink(videoCallLink4)
                             .Build();

            gatheringService.AddNewGathering(gathering4);

            // Retrieve the Gathering
            var retrievedGatherings = gatheringService.GetAllGatheringByEmail(organizerEmail);

            Assert.IsNotNull(retrievedGatherings);

            // Verify Gathering # 1
            Assert.AreEqual(title, retrievedGatherings[0].Title);
            Assert.AreEqual(description, retrievedGatherings[0].Description);
            Assert.AreEqual(dateOfMeeting, retrievedGatherings[0].DateOfMeeting);
            Assert.AreEqual(organizerEmail, retrievedGatherings[0].OrganizerEmail);
            Assert.AreEqual(topic, retrievedGatherings[0].Topic);
            Assert.IsNotNull(retrievedGatherings[0].Location);
            Assert.AreEqual(location.Latitude, retrievedGatherings[0].Location.Latitude);
            Assert.AreEqual(location.Longitude, retrievedGatherings[0].Location.Longitude);
            Assert.AreEqual(location.Area, retrievedGatherings[0].Location.Area);
            Assert.AreEqual(venue, retrievedGatherings[0].Venue);
            Assert.AreEqual(isVideoMeeting, retrievedGatherings[0].IsVideoGathering);
            Assert.IsTrue(string.IsNullOrEmpty(retrievedGatherings[0].VideoCallLink));

            // Verify Gathering # 2
            Assert.AreEqual(title2, retrievedGatherings[1].Title);
            Assert.AreEqual(description2, retrievedGatherings[1].Description);
            Assert.AreEqual(dateOfMeeting2, retrievedGatherings[1].DateOfMeeting);
            Assert.AreEqual(organizerEmail2, retrievedGatherings[1].OrganizerEmail);
            Assert.AreEqual(topic2, retrievedGatherings[1].Topic);
            Assert.IsNotNull(retrievedGatherings[1].Location);
            Assert.AreEqual(location2.Latitude, retrievedGatherings[1].Location.Latitude);
            Assert.AreEqual(location2.Longitude, retrievedGatherings[1].Location.Longitude);
            Assert.AreEqual(location2.Area, retrievedGatherings[1].Location.Area);
            Assert.AreEqual(venue2, retrievedGatherings[1].Venue);
            Assert.AreEqual(isVideoMeeting2, retrievedGatherings[1].IsVideoGathering);
            Assert.IsFalse(string.IsNullOrEmpty(retrievedGatherings[1].VideoCallLink));

            // Verify Gathering # 4
            Assert.AreEqual(title4, retrievedGatherings[2].Title);
            Assert.AreEqual(description4, retrievedGatherings[2].Description);
            Assert.AreEqual(dateOfMeeting4, retrievedGatherings[2].DateOfMeeting);
            Assert.AreEqual(organizerEmail4, retrievedGatherings[2].OrganizerEmail);
            Assert.AreEqual(topic4, retrievedGatherings[2].Topic);
            Assert.IsNotNull(retrievedGatherings[2].Location);
            Assert.AreEqual(location4.Latitude, retrievedGatherings[2].Location.Latitude);
            Assert.AreEqual(location4.Longitude, retrievedGatherings[2].Location.Longitude);
            Assert.AreEqual(location4.Area, retrievedGatherings[2].Location.Area);
            Assert.AreEqual(venue4, retrievedGatherings[2].Venue);
            Assert.AreEqual(isVideoMeeting4, retrievedGatherings[2].IsVideoGathering);
            Assert.IsTrue(string.IsNullOrEmpty(retrievedGatherings[2].VideoCallLink));
        }