Example #1
0
        public void CanDisinvolveUser()
        {
            BaseBeek story = new BaseBeek(BeekTypes.ShortStory);
            IUser writer = GenerateWriters().First();

            // Removing without adding first should not throw an exception
            story.DisInvolveUser(writer, Contributions.Writer);
            // Removing should remove the writer
            story.InvolveUser(writer, Contributions.Writer);
            story.DisInvolveUser(writer, Contributions.Writer);
            Assert.IsFalse(story.IsUserInvolvedAs(writer, Contributions.Writer));
            // Removing inexisting writers should not throw an exception
            story.DisInvolveUser(writer, Contributions.Writer);
            Assert.IsFalse(story.IsUserInvolvedAs(writer, Contributions.Writer));
            // Removing a user from one role, should not remove him from his other roles
            writer.AddContribution(Contributions.Illustrator);
            story.InvolveUser(writer, Contributions.Writer);
            story.InvolveUser(writer, Contributions.Illustrator);
            story.DisInvolveUser(writer, Contributions.Writer);
            Assert.IsTrue(story.IsUserInvolvedAs(writer, Contributions.Illustrator));
            Assert.IsFalse(story.IsUserInvolvedAs(writer, Contributions.Writer));
        }
Example #2
0
 public void CantAddNonWriterToWriters()
 {
     BaseBeek story = new BaseBeek(BeekTypes.ShortStory);
     IUser notWriter = GenerateUsers().First();
     Assert.IsFalse(notWriter.IsContributingAs(Contributions.Writer));
     story.InvolveUser(notWriter, Contributions.Writer);
 }
Example #3
0
        public void CanInvolveUser()
        {
            BaseBeek story = new BaseBeek(BeekTypes.ShortStory);
            IUser writer = GenerateWriters().First();

            story.InvolveUser(writer, Contributions.Writer);

            Assert.IsTrue(story.IsUserInvolvedAs(writer, Contributions.Writer));
            // Duplicates should be ignored
            story.InvolveUser(writer, Contributions.Writer);
            Assert.IsTrue(story.Involvements.Where(i => i.Key.Equals(writer) && i.Value.Equals(Contributions.Writer)).Count() == 1);
        }