Exemplo n.º 1
0
        public void Crud_Chip()
        {
            string testColor1 = "Poop", testColor2 = "Blood";
            int testValue1 = 69, testValue2 = 420;

            foreach (Chip c in repo.GetChips().Where(x
                    => x.Color.Equals(testColor1)
                    || x.Color.Equals(testColor2)))
                repo.DeleteChip(c);

            Chip chip = new Chip { Color = testColor1, Value = testValue1 };

            repo.AddChip(chip);
            Assert.AreEqual(1, repo.GetChips().Where(x
                => x.Color.Equals(testColor1)
                && x.Value == testValue1).Count());

            chip.Color = testColor2;
            chip.Value = testValue2;

            repo.UpdateChip(chip);
            Assert.AreEqual(1, repo.GetChips().Where(x
                => x.Color.Equals(testColor2)
                && x.Value == testValue2).Count());
            Assert.AreEqual(0, repo.GetChips().Where(x
                => x.Color.Equals(testColor1)
                && x.Value == testValue1).Count());

            repo.DeleteChip(chip);
            Assert.AreEqual(0, repo.GetChips().Where(x
                => x.Color.Equals(testColor1)
                && x.Value == testValue1).Count());
            Assert.AreEqual(0, repo.GetChips().Where(x
                => x.Color.Equals(testColor2)
                && x.Value == testValue2).Count());
        }
Exemplo n.º 2
0
 public void AddChip(Chip b)
 {
     Connection.Insert<Chip>(b);
 }
Exemplo n.º 3
0
 public void DeleteChip(Chip b)
 {
     Connection.Delete<Chip>(b);
 }
Exemplo n.º 4
0
 public void UpdateChip(Chip b)
 {
     Connection.Update<Chip>(b);
 }