public void Delete_ShouldDelete()
        {
            //arange
            PlaceRepository placeRep = new PlaceRepository(Properties.Resources.ConnectionString);
            MeetingRepository meetRep = new MeetingRepository(Properties.Resources.ConnectionString);
            UserRepository userRep = new UserRepository(Properties.Resources.ConnectionString);
            InvitationRepository inviteRep = new InvitationRepository(Properties.Resources.ConnectionString);
            Meeting meeting = TestDataHelper.GenerateMeeting();

            //act
            userRep.CreateUser(meeting.Owner);
            placeRep.CreatePlace(meeting.Place);
            meetRep.CreateMeeting(meeting);
            foreach (User user in meeting.InvitedPeople.Values)
            {
                userRep.CreateUser(user);
                inviteRep.Create(CreateInvitation(meeting, user));
            }

            Meeting resultMeeting = meetRep.GetMeeting(meeting.Id);
            if (resultMeeting != null) TestDataHelper.PrintMeetingInfo(resultMeeting);
            else Console.WriteLine("Meeting not exist");

            meetRep.DeleteMeeting(resultMeeting);
            resultMeeting = meetRep.GetMeeting(meeting.Id);

            //assert
            if (resultMeeting != null) TestDataHelper.PrintMeetingInfo(resultMeeting);
            else Console.WriteLine("Meeting deleted");
            Assert.IsNull(resultMeeting);
        }
        public void CreateInvitation_ShouldCreate()
        {
            //arange
            PlaceRepository placeRep = new PlaceRepository(Properties.Resources.ConnectionString);
            MeetingRepository meetRep = new MeetingRepository(Properties.Resources.ConnectionString);
            UserRepository userRep = new UserRepository(Properties.Resources.ConnectionString);
            InvitationRepository inviteRep = new InvitationRepository(Properties.Resources.ConnectionString);
            Meeting meeting = TestDataHelper.GenerateMeeting();

            //act
            userRep.CreateUser(meeting.Owner);
            placeRep.CreatePlace(meeting.Place);
            meetRep.CreateMeeting(meeting);

            foreach (User user in meeting.InvitedPeople.Values)
            {
                userRep.CreateUser(user);
                inviteRep.Create(CreateInvitation(meeting, user));
            }

            Meeting resultMeeting = meetRep.GetMeeting(meeting.Id);

            //assert
            TestDataHelper.PrintMeetingInfo(meeting);
            TestDataHelper.PrintMeetingInfo(resultMeeting);
            Assert.IsTrue(TestDataHelper.CompareInvitedUsersLists
                (meeting.InvitedPeople.Values, resultMeeting.InvitedPeople.Values));
        }
        public void DeleteInvitation_ShouldDelete()
        {
            //arange
            PlaceRepository placeRep = new PlaceRepository(Properties.Resources.ConnectionString);
            MeetingRepository meetRep = new MeetingRepository(Properties.Resources.ConnectionString);
            UserRepository userRep = new UserRepository(Properties.Resources.ConnectionString);
            InvitationRepository inviteRep = new InvitationRepository(Properties.Resources.ConnectionString);

            Meeting meeting = TestDataHelper.GenerateMeeting();
            User invitedUser = TestDataHelper.GenerateUser();

            meeting.InvitedPeople.Clear();

            //act
            userRep.CreateUser(meeting.Owner);
            placeRep.CreatePlace(meeting.Place);
            meetRep.CreateMeeting(meeting);

            userRep.CreateUser(invitedUser);
            inviteRep.Create(CreateInvitation(meeting, invitedUser));

            Meeting resultMeeting = meetRep.GetMeeting(meeting.Id);

            bool inviteResult = resultMeeting.InvitedPeople.Count == 1;
            TestDataHelper.PrintMeetingInfo(resultMeeting);

            inviteRep.Delete(CreateInvitation(resultMeeting, invitedUser));

            resultMeeting = meetRep.GetMeeting(meeting.Id);

            bool deleteResult = resultMeeting.InvitedPeople.Count == 0;

            //assert
            TestDataHelper.PrintMeetingInfo(resultMeeting);
            Assert.IsTrue(inviteResult & deleteResult);
        }
        public void Create_ShouldCreate()
        {
            //arange
            PlaceRepository placeRep = new PlaceRepository(Properties.Resources.ConnectionString);
            MeetingRepository meetRep = new MeetingRepository(Properties.Resources.ConnectionString);
            UserRepository userRep = new UserRepository(Properties.Resources.ConnectionString);
            Meeting meeting = TestDataHelper.GenerateMeeting();

            //act
            userRep.CreateUser(meeting.Owner);
            placeRep.CreatePlace(meeting.Place);
            meetRep.CreateMeeting(meeting);
            Meeting resultMeeting = meetRep.GetMeeting(meeting.Id);

            //assert
            TestDataHelper.PrintMeetingInfo(meeting);
            TestDataHelper.PrintMeetingInfo(resultMeeting);
            Assert.IsTrue(TestDataHelper.CompareMeetings(meeting, resultMeeting));
        }
        public void Update_ShouldUpdate()
        {
            //arange
            PlaceRepository placeRep = new PlaceRepository(Properties.Resources.ConnectionString);
            MeetingRepository meetRep = new MeetingRepository(Properties.Resources.ConnectionString);
            UserRepository userRep = new UserRepository(Properties.Resources.ConnectionString);
            Meeting firstMeeting = TestDataHelper.GenerateMeeting();
            Meeting secondMeeting = TestDataHelper.GenerateMeeting();
            secondMeeting.Id = firstMeeting.Id;
            secondMeeting.Owner = firstMeeting.Owner;
            secondMeeting.Place = firstMeeting.Place;
            secondMeeting.Title = "secondMeeting";
            secondMeeting.Description = "second descr";

            //act
            placeRep.CreatePlace(firstMeeting.Place);
            userRep.CreateUser(firstMeeting.Owner);
            meetRep.CreateMeeting(firstMeeting);

            meetRep.UpdateMeetingInfo(secondMeeting);
            Meeting resultMeeting = meetRep.GetMeeting(firstMeeting.Id);

            //assert
            TestDataHelper.PrintMeetingInfo(firstMeeting);
            TestDataHelper.PrintMeetingInfo(secondMeeting);
            TestDataHelper.PrintMeetingInfo(resultMeeting);
            Assert.IsTrue(TestDataHelper.CompareMeetings(secondMeeting, resultMeeting));
        }