public BaseBeek(BeekTypes type) { involvements = new List<KeyValuePair<IUser, Contributions>>(); relations = new List<KeyValuePair<BaseBeek, BeekRelationTypes>>(); writingStyles = new List<WritingStyle>(); genres = new List<BaseGenre>(); Type = type; Collection = new BeekCollection(); AddToCollection(new BeekCollection(), 1, null); DateCreated = DateTime.UtcNow; }
public void CanAddToCollection() { BaseBeek vol1 = new BaseBeek(BeekTypes.ShortStory); BaseBeek vol2 = new BaseBeek(BeekTypes.ShortStory); BaseBeek vol3 = new BaseBeek(BeekTypes.ShortStory); BaseBeek vol3Bis = new BaseBeek(BeekTypes.ShortStory); BaseBeek vol3B = new BaseBeek(BeekTypes.ShortStory); BeekCollection collection = new BeekCollection(); vol1.AddToCollection(collection, 1, null); vol2.AddToCollection(collection, 2, null); vol3.AddToCollection(collection, 3, null); Assert.IsTrue(collection.Count == 3); Assert.IsTrue(vol1.Collection == collection); Assert.IsTrue(vol1.VolumeNumber == 1); Assert.IsTrue(vol1.TotalVolumes == 3); vol3Bis.AddToCollection(collection, 3, null); Assert.IsTrue(vol1.TotalVolumes == 3); vol3B.AddToCollection(collection, 3, 'B'); Assert.IsTrue(vol1.TotalVolumes == 4); }
public void RemoveFromCollection() { Collection.Remove(this); Collection = new BeekCollection(); VolumeNumber = 0; SubVolume = null; }
public void AddToCollection(BeekCollection beekCollection, int volumeNumber, char? subVolume) { lock (Collection) { if (!beekCollection.Any(b => b.Equals(this))) { beekCollection.Add(this); } Collection = beekCollection; VolumeNumber = volumeNumber; SubVolume = subVolume; } }
public void CanRemoveFromCollection() { BaseBeek vol1 = new BaseBeek(BeekTypes.ShortStory); BaseBeek vol2a = new BaseBeek(BeekTypes.ShortStory); BaseBeek vol2b = new BaseBeek(BeekTypes.ShortStory); BeekCollection collection = new BeekCollection(); vol1.AddToCollection(collection, 1, null); vol2a.AddToCollection(collection, 2, 'a'); vol2b.AddToCollection(collection, 2, 'b'); Assert.IsTrue(vol1.Collection.Contains(vol2b)); vol2b.RemoveFromCollection(); Assert.IsFalse(vol1.Collection.Contains(vol2b)); Assert.IsTrue(vol2b.VolumeNumber == 0); }