Exemple #1
0
        public void AddComment()
        {
            Repository.UpdateBrood(DeepActivator.CreateInstance <BroodUpdate>());

            var broodUpdate = new BroodUpdate
            {
                Broods = new List <Brood>
                {
                    new Brood
                    {
                        Id       = 1,
                        Action   = Action.None,
                        Comments = new List <BroodComment>
                        {
                            new BroodComment
                            {
                                Action  = Action.Create,
                                Comment = "Bar"
                            }
                        }
                    }
                }
            };

            broodUpdate.Broods.First().Comments.First().Brood = broodUpdate.Broods.First();

            Repository.UpdateBrood(broodUpdate);

            Assert.AreEqual("Foo", Context.Broods.First().Comments.First().Comment);
            Assert.AreEqual("Bar", Context.Broods.First().Comments.Last().Comment);
            Assert.AreEqual(1, Context.Broods.First().Days.Count());
        }
Exemple #2
0
        public void UpdatePartial()
        {
            Repository.UpdateBrood(DeepActivator.CreateInstance <BroodUpdate>());
            Assert.AreEqual(1, Context.Broods.First().Comments.Count());

            var broodUpdate = new BroodUpdate
            {
                Broods = new List <Brood>
                {
                    new Brood
                    {
                        Id      = 1,
                        Action  = Action.Update,
                        Changes = new List <string> {
                            "BroodNumber"
                        },
                        BroodNumber = 13,
                        FemaleCount = 100
                    }
                }
            };

            Repository.UpdateBrood(broodUpdate);
            Assert.AreEqual(1, Context.Broods.First().Comments.Count());
            Assert.AreEqual(13, Context.Broods.First().BroodNumber);
            Assert.AreEqual(1, Context.Broods.First().FemaleCount);
        }
Exemple #3
0
        public void DeleteBrood()
        {
            Repository.UpdateBrood(DeepActivator.CreateInstance <BroodUpdate>());

            var broodUpdate = new BroodUpdate
            {
                Broods = new List <Brood>
                {
                    new Brood
                    {
                        Id     = 1,
                        Action = Action.Delete
                    }
                }
            };

            Repository.UpdateBrood(broodUpdate);

            Assert.AreEqual(0, Context.Broods.Count());
        }