private async Task SeedBookmarkWithMarks(PMGDbContext context) { var mathMark = new Mathematics() { Mark = 3, bookmark = Bookmark, Day = DateTime.UtcNow }; var englishMark = new English() { Mark = 4, bookmark = Bookmark, Day = DateTime.UtcNow }; var philosophyMark = new Philosophy() { Mark = 5, bookmark = Bookmark, Day = DateTime.UtcNow }; context.Mathematics.Add(mathMark); context.Add(englishMark); context.Philosophy.Add(philosophyMark); context.SaveChanges(); }
public void Card_PhilosophyAction1() { //testGame.Players[0].AlwaysParticipates = true; //testGame.Players[0].SelectsCards = new List<int>() { 0 }; testGame.Players[0].Tableau.Stacks[Color.Blue].AddCardToTop( new Card { Name = "Test Blue Card", Color = Color.Blue, Age = 1, Top = Symbol.Blank, Left = Symbol.Crown, Center = Symbol.Crown, Right = Symbol.Leaf } ); bool result = new Philosophy().Actions.ToList()[0].ActionHandler(new CardActionParameters { TargetPlayer = testGame.Players[0], Game = testGame, ActivePlayer = testGame.Players[0], PlayerSymbolCounts = new Dictionary <IPlayer, Dictionary <Symbol, int> >() }); Assert.AreEqual(true, result); Assert.AreEqual(3, testGame.Players[0].Hand.Count); Assert.AreEqual(3, testGame.AgeDecks.Where(x => x.Age == 1).FirstOrDefault().Cards.Count); Assert.AreEqual(3, testGame.AgeDecks.Where(x => x.Age == 2).FirstOrDefault().Cards.Count); Assert.AreEqual(0, testGame.Players[0].Tableau.ScorePile.Count); Assert.AreEqual(0, testGame.Players[1].Tableau.ScorePile.Count); Assert.AreEqual(2, testGame.Players[0].Tableau.Stacks[Color.Blue].Cards.Count); Assert.AreEqual(SplayDirection.Left, testGame.Players[0].Tableau.Stacks[Color.Blue].SplayedDirection); Assert.AreEqual(0, testGame.Players[0].Tableau.Stacks[Color.Green].Cards.Count); Assert.AreEqual(1, testGame.Players[0].Tableau.Stacks[Color.Red].Cards.Count); Assert.AreEqual(0, testGame.Players[0].Tableau.Stacks[Color.Purple].Cards.Count); Assert.AreEqual(0, testGame.Players[0].Tableau.Stacks[Color.Yellow].Cards.Count); }
public async Task CreateMarkPhilosophyAsync(decimal mark, PMGUser user) { Philosophy philosophy = new Philosophy { Mark = mark, Day = DateTime.UtcNow }; user.Bookmark.PhilosophyMarks.Add(philosophy); await context.SaveChangesAsync(); }
// GET api/<controller> public IEnumerable <Philosophy> Get() { try { int UserID = Convert.ToInt32(HttpContext.Current.User.Identity.Name); Philosophy[] _AllPhilosophy = new Philosophy().GetUnAnsweredQuestions(UserID); return(_AllPhilosophy); } catch (Exception ex) { Error.LogError(ex, "IEnumerable<Philosophy> Get()"); return(null); } }
public void Card_PhilosophyAction1_NothingHappens() { //testGame.Players[0].AlwaysParticipates = true; //testGame.Players[0].SelectsCards = new List<int>() { 0 }; bool result = new Philosophy().Actions.ToList()[0].ActionHandler(new CardActionParameters { TargetPlayer = testGame.Players[0], Game = testGame, ActivePlayer = testGame.Players[0], PlayerSymbolCounts = new Dictionary <IPlayer, Dictionary <Symbol, int> >() }); Assert.AreEqual(true, result); Assert.AreEqual(3, testGame.Players[0].Hand.Count); Assert.AreEqual(3, testGame.AgeDecks.Where(x => x.Age == 1).FirstOrDefault().Cards.Count); Assert.AreEqual(3, testGame.AgeDecks.Where(x => x.Age == 2).FirstOrDefault().Cards.Count); Assert.AreEqual(0, testGame.Players[0].Tableau.ScorePile.Count); Assert.AreEqual(0, testGame.Players[1].Tableau.ScorePile.Count); Assert.AreEqual(1, testGame.Players[0].Tableau.Stacks[Color.Blue].Cards.Count); Assert.AreEqual(0, testGame.Players[0].Tableau.Stacks[Color.Green].Cards.Count); Assert.AreEqual(1, testGame.Players[0].Tableau.Stacks[Color.Red].Cards.Count); Assert.AreEqual(0, testGame.Players[0].Tableau.Stacks[Color.Purple].Cards.Count); Assert.AreEqual(0, testGame.Players[0].Tableau.Stacks[Color.Yellow].Cards.Count); }