コード例 #1
0
        public void CreateSubmissionFormTest()
        {
            DatabaseHelper        Dh                = new DatabaseHelper(true);
            SubmissionService     SubSrv            = new SubmissionService(Dh.Db);
            string                testName          = "Test 1";
            string                testDescription   = "This is a form for the first test.";
            string                testPrefix        = "Test 1 ";
            FormFieldNameComparer fomrFieldComparer = new FormFieldNameComparer();

            Form form1 = CreateFormTemplate(SubSrv, testName, testDescription, testPrefix);

            Dh.Db.SaveChanges();
            Form form2 = SubSrv.GetForm <Form>(form1.Id);

            Assert.AreEqual(form2.Name, testName);
            Assert.AreEqual(form2.Description, testDescription);
            CollectionAssert.AreEqual(form1.Fields, form2.Fields, fomrFieldComparer);
        }
コード例 #2
0
        public void CreateSubmissionFormTest()
        {
            DatabaseHelper    Dh              = new DatabaseHelper(true);
            SubmissionService SubSrv          = new SubmissionService(Dh.Db);
            string            testName        = "Test 1";
            string            testDescription = "This is a form for the first test.";
            string            testPrefix      = "Test 1 ";
            Form form1 = CreateFormTemplate(SubSrv, testName, testDescription, testPrefix);

            Dh.Db.SaveChanges();

            Form form2 = SubSrv.GetForm <Form>(form1.Id);

            Assert.AreEqual(form2.Name, testName);
            Assert.AreEqual(form2.Description, testDescription);
            Assert.AreNotEqual(0, form2.Fields.Count);

            foreach (FormField field in form2.Fields)
            {
                Assert.IsTrue(field.Name.StartsWith(testPrefix));
            }

            Assert.AreEqual(form1.Fields.Count, form2.Fields.Count);
        }