Пример #1
0
        public void JsonRepository_Delete_Succeeds()
        {
            var repo     = new JsonRepository();
            var existing = repo.Recipes.Single(r => r.Id == 1);

            repo.Delete(existing)
            .SaveChanges();

            existing = repo.Recipes.SingleOrDefault(r => r.Id == 1);

            Assert.IsNull(existing);
        }
        public void IngredientJsonRepository_Delete_Succeeds()
        {
            var repo       = new JsonRepository();
            var ingredient = repo.Ingredients.Single(i => i.Id == 1);

            repo.Delete(ingredient)
            .SaveChanges();

            repo = new JsonRepository();

            var shouldBeNull = repo.Ingredients.SingleOrDefault(i => i.Id == 1);

            Assert.IsNull(shouldBeNull);
            Assert.AreEqual(1, repo.Ingredients.Count());
        }
Пример #3
0
        public async void CreateReadDelete_CreatedJson_ShouldHaveSameId()
        {
            try
            {
                var expectedRetro = m_retroBuilder.ValidRetro().Build();

                await m_cut.Create(expectedRetro);

                var retros = await m_cut.Read();

                if (retros.Count == 1)
                {
                    var readRetro = retros.First();
                    readRetro.Id.Should().Be(expectedRetro.Id);
                }

                await m_cut.Delete(expectedRetro);
            }
            catch (Exception)
            {
                Assert.True(false);
            }
        }