예제 #1
0
        private void SaveData(FormsContext context)
        {
            var form = new Form { Id = Guid.NewGuid(), Title = "Performance Review" };
            var topic = new Topic { Title = "Competencias Core" };
            form.Topics.Add(topic);
            topic.Questions.Add(this.GetQuestion("Comunicación con sus pares"));
            topic.Questions.Add(this.GetQuestion("Comunicación con el cliente"));
            topic.Questions.Add(this.GetQuestion("Administración de sus tareas"));
            topic.Questions.Add(this.GetQuestion("Cumplimiento de tareas"));

            topic = new Topic { Title = "Competencias Técnicas" };
            form.Topics.Add(topic);
            topic.Questions.Add(this.GetQuestion("Conocimiento Técnico"));
            topic.Questions.Add(this.GetQuestion("Resolución de Problemas Complejos"));
            topic.Questions.Add(this.GetNetChoiceQuestion("Versiones de .NET Trabajadas"));
            topic.Questions.Add(this.GetPlatformChoiceQuestion("Plataformas Trabajadas"));

            topic = new Topic { Title = "Feedback" };
            form.Topics.Add(topic);
            topic.Questions.Add(this.GetFreeTextQuestion("Relación con el manager"));
            topic.Questions.Add(this.GetFreeTextQuestion("Relación con sus pares"));
            topic.Questions.Add(this.GetFreeTextQuestion("Qué opinas de la empresa?"));

            context.Forms.Add(form);
            context.SaveChanges();
        }
예제 #2
0
        public void DatabaseInitialize()
        {
            // Act
            var context = new FormsContext();

            // Clear existing data
            context.Answers.ToList().ForEach(answer => context.Answers.Remove(answer));
            context.Questions.ToList().ForEach(question => context.Questions.Remove(question));
            context.Topics.ToList().ForEach(topic => context.Topics.Remove(topic));
            context.Forms.ToList().ForEach(form => context.Forms.Remove(form));

            // Add Default Sample Data
            this.SaveData(context);
            var forms = context.Forms;
            var topics = context.Topics;
            var answers = context.Answers;
            var questions = context.Questions;

            // Assert
            Assert.IsNotNull(forms);
            Assert.IsNotNull(topics);
            Assert.IsNotNull(questions);
            Assert.IsNotNull(answers);
            Assert.IsTrue(forms.Any());
            Assert.IsTrue(topics.Any());
            Assert.IsTrue(questions.Any());
            Assert.IsTrue(answers.Any());
        }
예제 #3
0
        public ActionResult GenerateData()
        {
            // Act
            var context = new FormsContext();

            // Clear existing data
            context.Answers.ToList().ForEach(answer => context.Answers.Remove(answer));
            context.Questions.ToList().ForEach(question => context.Questions.Remove(question));
            context.Topics.ToList().ForEach(topic => context.Topics.Remove(topic));
            context.Forms.ToList().ForEach(form => context.Forms.Remove(form));

            // Add Default Sample Data
            this.SaveData(context);

            return this.View();
        }