public ControllerContextBuilder <TContoller> BuildMission() { context.WithEntity(new Mission { Title = "Unit Test Mission", Id = missionId }); var level = new MissionLevel { AwardTitle = awardTitle, Id = missionLevelId, Level = missionLevel, Name = missionName, Tracks = tracks, MissionId = missionId }; foreach (var track in tracks) { context.WithEntity(track.Badge); foreach (var challenge in track.Challenges) { // Make sure the challenges are attached to this track and added to the dataset. challenge.MissionTrackId = track.Id; context.WithEntity(challenge); } track.MissionLevelId = missionLevelId; context.WithEntity(track); } context.WithEntity(level); return(context); }
/// <summary> /// Determines whether the supplied set of observations are sufficient to complete the given level. /// </summary> /// <param name="level">The level.</param> /// <param name="observations">The observations.</param> /// <returns><c>true</c> if [is level complete] [the specified level]; otherwise, <c>false</c>.</returns> /// <exception cref="System.NotImplementedException"></exception> public bool IsLevelComplete(MissionLevel level, IEnumerable <Observation> observations) { var eligibleObservations = observations as IList <Observation> ?? observations.ToList(); foreach (var track in level.Tracks) { var percentComplete = ComputePercentComplete(track.Challenges, eligibleObservations); if (percentComplete == 100) { return(true); } } return(false); }
public override Dictionary <string, object> SaveToDict() { var dict = new Dictionary <string, object>(); dict.Add(GDMConstants.SchemaKey, "Missions"); dict.Merge(true, FirstCard.ToGDEDict(FirstCardKey)); dict.Merge(true, Fight.ToGDEDict(FightKey)); dict.Merge(true, MissionLevel.ToGDEDict(MissionLevelKey)); dict.Merge(true, MissionName.ToGDEDict(MissionNameKey)); dict.Merge(true, MissionDescription.ToGDEDict(MissionDescriptionKey)); dict.Merge(true, NextCard.ToGDEDict(NextCardKey)); dict.Merge(true, AnswerA.ToGDEDict(AnswerAKey)); dict.Merge(true, AnswerB.ToGDEDict(AnswerBKey)); dict.Merge(true, AnswerC.ToGDEDict(AnswerCKey)); dict.Merge(true, AnswerD.ToGDEDict(AnswerDKey)); return(dict); }