public void ProjectRepository_CreateCollaboration_ShouldCreateNewCollaborationInDB()
        {
            var projects = new ProjectRepository();
            var mockProjectID = Guid.NewGuid();

            var invitation = projects.CreateCollaboration(mockProjectID, "*****@*****.**");

            Assert.AreEqual(mockProjectID, invitation.ProjectID);
            Assert.AreEqual("*****@*****.**", invitation.Email);
        }
        public void ProjectRepository_AcceptInvitation_ShouldSavetheUserIDInTheDB()
        {
            //create a test user in the database
            var db = new ApplicationDBContext();
            var user = new UserProfile();
            user.UserName = "******" + Guid.NewGuid().ToString();
            db.UserProfiles.Add(user);
            db.SaveChanges();

            //ok. on to the test now
            var projects = new ProjectRepository();
            var project = createTestProject(987);
            projects.Create(project);

            var invitation = projects.CreateCollaboration(project.ID, "*****@*****.**");
            projects.AcceptCollaboration(invitation.ID, user.UserId);

            var sharedProjectIDs = new List<Guid>();
            CollectionAssert.DoesNotContain(sharedProjectIDs, project.ID);
            sharedProjectIDs = projects.FindProjectsSharedWithUser(user.UserId).Select(col => col.ID).ToList();
            CollectionAssert.Contains(sharedProjectIDs, project.ID);
        }
        public void ProjectRepository_SendInvitation_ShoudltryToSendAnEmailWithInvitaion()
        {
            var projects = new ProjectRepository();
            var mockProjectID = Guid.NewGuid();
            var mockEmailSender = A.Fake<IEmailSender>();
            var invitation = projects.CreateCollaboration(mockProjectID, "*****@*****.**");

            A.CallTo(() => mockEmailSender.SendMail("", "", "")).WithAnyArguments().MustNotHaveHappened();
            projects.SendInvitation(invitation, mockEmailSender);
            A.CallTo(() => mockEmailSender.SendMail("", "", "")).WithAnyArguments().MustHaveHappened();

            Assert.AreEqual(mockProjectID, invitation.ProjectID);
            Assert.AreEqual("*****@*****.**", invitation.Email);
        }