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); }
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); }
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); }