public void Restriction_Min() { var sut = LevelStarFactory.GetLevelStar(2, new string[] { "", "", "Min", "2" }, null); Assert.AreEqual(typeof(MinSequenceLimit), sut.Restriction.GetType()); Assert.AreEqual(2, (sut.Restriction as MinSequenceLimit).MinLimit); }
public void Restriction_Bannned() { var sut = LevelStarFactory.GetLevelStar(2, new string[] { "", "", "Banned", "1" }, null); Assert.AreEqual(typeof(Scripts.Workers.Score_and_Limits.BannedSprite), sut.Restriction.GetType()); Assert.AreEqual(1, (sut.Restriction as Scripts.Workers.Score_and_Limits.BannedSprite).SpriteValue); }
public void Restriction_Max() { var sut = LevelStarFactory.GetLevelStar(2, new string[] { "", "", "Max", "3" }, null); Assert.AreEqual(typeof(MaxSequenceLimit), sut.Restriction.GetType()); Assert.AreEqual(3, (sut.Restriction as MaxSequenceLimit).MaxLimit); }
public void Restriction_Type() { var sut = LevelStarFactory.GetLevelStar(2, new string[] { "", "", "Type", "r" }, null); Assert.AreEqual(typeof(BannedPieceType), sut.Restriction.GetType()); Assert.AreEqual(PieceTypes.Rainbow, (sut.Restriction as BannedPieceType).BannedPiece); }
public void Limit_Time() { var sut = LevelStarFactory.GetLevelStar(2, new string[] { "Time", "5" }, null); Assert.AreEqual(typeof(TimeLimit), sut.Limit.GetType()); Assert.AreEqual("5 seconds", (sut.Limit as TimeLimit).GetDescription()); }
private void LoadLevelStars(Dictionary <string, Level[]> levelDTO, Dictionary <string, Level_Info.Level[]> levels) { CheckForInitialisation(); var events = eventReader.GetEvents(); foreach (var chapter in levels) { var eventsForChapter = events.ContainsKey(chapter.Key) ? events[chapter.Key] : null; foreach (var level in chapter.Value) { if (level == null) { continue; } var eventsForLevel = eventsForChapter?.FirstOrDefault(x => x.LevelNumber == level.LevelNumber); var dto = levelDTO[chapter.Key].FirstOrDefault(x => x.LevelNumber == level.LevelNumber); level.Star1Progress = LevelStarFactory.GetLevelStar(1, dto.Star1, eventsForLevel?.Star1); level.Star2Progress = LevelStarFactory.GetLevelStar(2, dto.Star2, eventsForLevel?.Star2); level.Star3Progress = LevelStarFactory.GetLevelStar(3, dto.Star3, eventsForLevel?.Star3); } } }
public void Events() { var testEvent = new LevelEvents.EventTrigger[] { new LevelEvents.EventTrigger() { Trigger = "Turns", TriggerOn = "1-2", Events = new LevelEvents.Event[] { new LevelEvents.Event() { EventType = "Destroy", NumberOfPiecesToSelect = 2 } } } }; var sut = LevelStarFactory.GetLevelStar(2, null, testEvent); Assert.IsNotNull(sut.Events); }
public void Restriction_Bannned_InvalidFormat() { Assert.Throws <FormatException>(() => LevelStarFactory.GetLevelStar(2, new string[] { "", "", "Banned", "Red" }, null)); }
public void Restriction_Max_InvalidFormat() { Assert.Throws <FormatException>(() => LevelStarFactory.GetLevelStar(2, new string[] { "", "", "Max", "Two" }, null)); }
public void Limit_NoData() { var sut = LevelStarFactory.GetLevelStar(2, null, null); Assert.IsNull(sut.Limit); }
public void Limit_EmptyData() { var sut = LevelStarFactory.GetLevelStar(2, new string[] { "", "" }, null); Assert.IsNull(sut.Limit); }
public void Restriction_NoValues() { var sut = LevelStarFactory.GetLevelStar(2, new string[] { "", "" }, null); Assert.AreEqual(typeof(Assets.Scripts.Workers.Score_and_Limits.NoRestriction), sut.Restriction.GetType()); }
public void Restriction_TurnTimeLimit() { var sut = LevelStarFactory.GetLevelStar(2, new string[] { "", "", "Time", "6" }, null); Assert.AreEqual(typeof(TurnTimeLimit), sut.Restriction.GetType()); }
public void CorrectStarNumber() { var sut = LevelStarFactory.GetLevelStar(2, null, null); Assert.AreEqual(2, sut.Number); }
public void Restriction_DiagonalOnly() { var sut = LevelStarFactory.GetLevelStar(2, new string[] { "", "", "Diagonal Only", "" }, null); Assert.AreEqual(typeof(DiagonalOnlyRestriction), sut.Restriction.GetType()); }
public void Restriction_BannedLocked() { var sut = LevelStarFactory.GetLevelStar(2, new string[] { "", "", "Banned Locked", "" }, null); Assert.AreEqual(typeof(Assets.Scripts.Workers.Score_and_Limits.SwapEffectLimit), sut.Restriction.GetType()); }