示例#1
0
        public IEnumerable <Questionnaire> ShowQuestionniare()
        {
            //[FromBody] string[] topics
            NpgsqlConnection conn = new NpgsqlConnection($"Server=127.0.0.1; Port=5432; User Id={Environment.GetEnvironmentVariable("DB_USER")}; Password={Environment.GetEnvironmentVariable("DB_PASSWORD")}; Database=surveys");

            //string[] choices = new string[] { };
            String[] choices = new string[2] {
                "Infrastructure", "Compliancy"
            };
            gateway             = new GetQuestionnairesGateway(choices, conn);
            fetchQuestionnaires = new FetchQuestionnaires(gateway);
            return(fetchQuestionnaires.Execute());
        }
        public void itGroupsQuestionnaires()
        {
            var mockGateway = new Mock <IGetQuestionnairesGateway>();

            Questionnaire[] questionnaires = new Questionnaire[]
            {
                new Questionnaire {
                },
                new Questionnaire {
                },
            };

            mockGateway.Setup(p => p.getQuestionnaires()).Returns(questionnaires);
            fetchQuestionnaires = new FetchQuestionnaires(mockGateway.Object);
            fetchQuestionnaires.Execute();
            mockGateway.Verify(mockGateway => mockGateway.getQuestionnaires(), Times.Once());
        }