Ejemplo n.º 1
0
        public void testAddDefinitions()
        {
            Assert.Null(serv.GetByWord(word));
            // Arrange
            int count = serv.All().Count();

            serv.Add(entity);

            Assert.Null(serv.GetByWord("harambe"));


            Assert.AreEqual(count + 1, serv.All().Count());
            entity.addDefinitions(new List <string>()
            {
                "1rerer is good      ", "babuba"
            });


            // Act
            MichtavaResult res = serv.Update(entity);

            // Assert
            Assert.True(res is MichtavaSuccess);
            Assert.NotNull(serv.GetByWord(word));
            Assert.True(serv.HardDelete(entity) is MichtavaSuccess);
        }
Ejemplo n.º 2
0
        private void SeedDefinitions(ApplicationDbContext context)
        {
            //if (context.Definitions.Any())
            //{
            //    return;
            //}

            //if (System.Diagnostics.Debugger.IsAttached == false)
            //{

            //    System.Diagnostics.Debugger.Launch();

            //}


            for (int j = 0; j < words.Count; j++)
            {
                WordDefinition def = new WordDefinition();
                def.Word = words.ElementAt(j);
                def.addDefinitions(definitionLists.ElementAt(j));

                context.Definitions.AddOrUpdate(def);
            }

            context.SaveChanges();
        }