コード例 #1
0
 public void SaveFormDataTest()
 {
     MongoDBLayer dblayer = new MongoDBLayer();
     MVCDynamicForms.Form form = FormProvider.GetFormWithData();
     form.ContentId = Guid.NewGuid();
     form.SiteId = Guid.NewGuid();
     dblayer.Save<FormData>(new FormData { ContentId = form.ContentId, Content = form.ToJson(true), SiteId = form.SiteId });
 }
コード例 #2
0
        public void FormDataGetTest()
        {
            MVCDynamicForms.Form form = FormProvider.GetFormWithData();
            form.ContentId = Guid.NewGuid();
            MongoDBLayer dblayer = new MongoDBLayer();

            FormData expected = new FormData();
            expected.ContentId = form.ContentId;
            expected.Content = form.ToJson();
            dblayer.Save<FormData>(expected);

            FormData actual = new FormData();
            actual = dblayer.Get<FormData>(form.ContentId);

            Assert.IsNotNull(actual);
            Assert.AreEqual(expected.ContentId, actual.ContentId);

            // now clean up test data.
            dblayer.Delete<FormData>(form.ContentId);
        }
コード例 #3
0
        public void SaveFormData_Test()
        {
            MVCDynamicForms.Form form = FormProvider.GetFormWithData();
            form.ContentId = Guid.NewGuid();
            MongoDBLayer dblayer = new MongoDBLayer();

            FormData formdata = new FormData();
            formdata.ContentId = form.ContentId;
            formdata.Content = form.ToJson();
            dblayer.Save<FormData>(formdata);
        }
コード例 #4
0
        public void SaveFormDataWithTagsTest()
        {
            MongoDBLayer dblayer = new MongoDBLayer();
            MVCDynamicForms.Form form = FormProvider.GetFormWithData();
            form.ContentId = Guid.NewGuid();
            FormData formData = new FormData { ContentId = form.ContentId, Content = form.ToJson(true) };
            formData.Tags = new List<string>();
            formData.Tags.Add("Bar1");
            formData.Tags.Add("Bar2");
            formData.Tags.Add("Bar3");
            dblayer.Save<FormData>(formData);

            formData = new FormData { ContentId = form.ContentId, Content = form.ToJson(true) };
            formData.Tags = new List<string>();
            formData.Tags.Add("foo1");
            formData.Tags.Add("foo2");
            formData.Tags.Add("foo3");
            dblayer.Save<FormData>(formData);

            formData = new FormData { ContentId = form.ContentId, Content = form.ToJson(true) };
            formData.Tags = new List<string>();
            formData.Tags.Add("test1");
            formData.Tags.Add("test2");
            formData.Tags.Add("test3");
            dblayer.Save<FormData>(formData);
        }
コード例 #5
0
 public void SaveFormStructureTest()
 {
     MongoDBLayer dblayer = new MongoDBLayer();
     MVCDynamicForms.Form form = FormProvider.GetForm();
     form.ContentId = Guid.NewGuid();
     form.SiteId = Guid.NewGuid();
     dblayer.Save<MVCDynamicForms.Form>(form);
 }