Exemplo n.º 1
0
        public void User_Can_Add_New_Snag()
        {
            var repo          = new SnagRepository(_context);
            var startingSnags = repo.GetByRibbon(1);
            var startingCount = startingSnags.Count;

            var newSnag = new Snag()
            {
                RibbonId    = 1,
                DateCreated = DateTime.Now - TimeSpan.FromDays(365),
                Note        = "snag note 1",
                Seconds     = 70
            };

            //add new snag
            repo.Add(newSnag);

            //Get all snags again
            var resultingRibbons = repo.GetByRibbon(1);
            var resultingCount   = resultingRibbons.Count;

            //Check that one has been added
            Assert.NotEqual(0, newSnag.Id);
            Assert.Equal(startingCount + 1, resultingCount);
        }
Exemplo n.º 2
0
        public void User_Can_Delete_Snag()
        {
            var snag = 1;
            var repo = new SnagRepository(_context);

            // Attempt to delete it
            repo.Delete(snag);

            // Now attempt to get it
            var result = repo.GetById(snag);

            Assert.Null(result);
        }