public void RunBattleReturns_WithTransformerWithHigherScore() { using (var context = getDBContext()) { Models.DB.Transformer autoBotTransformer = new Models.DB.Transformer() { Name = "TestA", AllegianceTypeId = (int)AllegianceTypes.Autobot, Courage = 2, Endurance = 2, Firepower = 2, Intelligence = 2, Rank = 2, Skill = 2, Speed = 2, Strength = 2 }; Models.DB.Transformer decepticonTransformer = new Models.DB.Transformer() { Name = "TestB", AllegianceTypeId = (int)AllegianceTypes.Decepticon, Courage = 1, Endurance = 1, Firepower = 1, Intelligence = 1, Rank = 1, Skill = 1, Speed = 1, Strength = 1 }; var warsService = new WarService(context, _mockLogger.Object); var winnerResult = warsService.GetWinner(autoBotTransformer, decepticonTransformer); Assert.Equal(AllegianceTypes.Autobot, winnerResult); context.Database.EnsureDeleted(); } }
public void RunBattleReturns_ErrorWithSameAllegiance() { using (var context = getDBContext()) { Models.DB.Transformer autoBotTransformer = new Models.DB.Transformer() { Name = "TestA", AllegianceTypeId = (int)AllegianceTypes.Autobot, Courage = 1, Endurance = 1, Firepower = 1, Intelligence = 1, Rank = 1, Skill = 1, Speed = 1, Strength = 1 }; Models.DB.Transformer decepticonTransformer = new Models.DB.Transformer() { Name = "TestB", AllegianceTypeId = (int)AllegianceTypes.Autobot, Courage = 1, Endurance = 1, Firepower = 1, Intelligence = 1, Rank = 2, Skill = 1, Speed = 1, Strength = 1 }; var warsService = new WarService(context, _mockLogger.Object); Assert.Throws <Exception>(() => warsService.GetWinner(autoBotTransformer, decepticonTransformer)); context.Database.EnsureDeleted(); } }