Пример #1
0
        public void UpdateFormDataFragmentInvalidJsonThrowsUnsupportedOperationExceptionTest()
        {
            var testClass = GetTestClass();

            var          serilializedService      = new JsonSerializationService();
            var          dataFragmentService      = new DataFragmentJsonService(serilializedService);
            var          serializedObject         = serilializedService.SerializeFormData(testClass);
            const string serializedFragmentObject = "<xml>Not Json</xml>";

            dataFragmentService.UpdateFragment(serializedObject, serializedFragmentObject, "Owners", new KeyValuePair <string, string>());
        }
Пример #2
0
        public void UpdateFormDataFragmentUpdateFragmentThrowsNotFoundExceptionTest()
        {
            var testClass        = GetTestClass();
            var updatedTestClass = GetUpdatedTestClass();

            var serilializedService      = new JsonSerializationService();
            var dataFragmentService      = new DataFragmentJsonService(serilializedService);
            var serializedObject         = serilializedService.SerializeFormData(testClass);
            var serializedFragmentObject = serilializedService.SerializeFormData(updatedTestClass.Owners);

            dataFragmentService.UpdateFragment(serializedObject, serializedFragmentObject, "InvalidFragmentName", new KeyValuePair <string, string>());
        }
        public void UpdateFormDataFragmentReturnsSerializedStringTest()
        {
            var testClass = GetTestClass();
            var updatedTestClass = GetUpdatedTestClass();

            var serilializedService = new JsonSerializationService();
            var dataFragmentService = new DataFragmentJsonService(serilializedService);
            var serializedObject = serilializedService.SerializeFormData(testClass);
            var serializedFragmentObject = serilializedService.SerializeFormData(updatedTestClass.Owners);

            var result = dataFragmentService.UpdateFragment(serializedObject, serializedFragmentObject, "Owners", new KeyValuePair<string, string>());
            Assert.IsInstanceOfType(result, typeof(string));
        }
Пример #4
0
        public void UpdateFormDataFragmentUpdateFilteredFragmentThrowsNotFoundExceptionTest()
        {
            var testClass        = GetTestClass();
            var updatedTestClass = GetUpdatedTestClass();

            var serilializedService      = new JsonSerializationService();
            var dataFragmentService      = new DataFragmentJsonService(serilializedService);
            var serializedObject         = serilializedService.SerializeFormData(testClass);
            var serializedFragmentObject = serilializedService.SerializeFormData(updatedTestClass.Owners);
            var filterQuery = new KeyValuePair <string, string>("Id", "6");

            dataFragmentService.UpdateFragment(serializedObject, serializedFragmentObject, "Owners", filterQuery);
        }
Пример #5
0
        public void UpdateFormDataFragmentReturnsSerializedStringTest()
        {
            var testClass        = GetTestClass();
            var updatedTestClass = GetUpdatedTestClass();

            var serilializedService      = new JsonSerializationService();
            var dataFragmentService      = new DataFragmentJsonService(serilializedService);
            var serializedObject         = serilializedService.SerializeFormData(testClass);
            var serializedFragmentObject = serilializedService.SerializeFormData(updatedTestClass.Owners);

            var result = dataFragmentService.UpdateFragment(serializedObject, serializedFragmentObject, "Owners", new KeyValuePair <string, string>());

            Assert.IsInstanceOfType(result, typeof(string));
        }
        public void UpdateFormDataArrayFragmentReturnsUpdatedSerializedStringTest()
        {
            var testClass = GetTestClass();
            var updatedTestClass = GetUpdatedTestClass();

            var serilializedService = new JsonSerializationService();
            var dataFragmentService = new DataFragmentJsonService(serilializedService);
            var serializedObject = serilializedService.SerializeFormData(testClass);
            var serializedFragmentObject = serilializedService.SerializeFormData(updatedTestClass.Owners);

            testClass.Owners = updatedTestClass.Owners;
            var expectedSerializedObject = serilializedService.SerializeFormData(testClass);

            var result = dataFragmentService.UpdateFragment(serializedObject, serializedFragmentObject, "Owners", new KeyValuePair<string, string>());
            Assert.AreEqual(expectedSerializedObject, result);
        }
Пример #7
0
        public void UpdateFormDataArrayFragmentReturnsUpdatedSerializedStringTest()
        {
            var testClass        = GetTestClass();
            var updatedTestClass = GetUpdatedTestClass();

            var serilializedService      = new JsonSerializationService();
            var dataFragmentService      = new DataFragmentJsonService(serilializedService);
            var serializedObject         = serilializedService.SerializeFormData(testClass);
            var serializedFragmentObject = serilializedService.SerializeFormData(updatedTestClass.Owners);

            testClass.Owners = updatedTestClass.Owners;
            var expectedSerializedObject = serilializedService.SerializeFormData(testClass);

            var result = dataFragmentService.UpdateFragment(serializedObject, serializedFragmentObject, "Owners", new KeyValuePair <string, string>());

            Assert.AreEqual(expectedSerializedObject, result);
        }
        public void UpdateFormDataFilteredArrayFragmentReturnsUpdatedSerializedStringTest()
        {
            var testClass = GetTestClass();
            var updatedTestClass = GetUpdatedTestClass();

            var serilializedService = new JsonSerializationService();
            var dataFragmentService = new DataFragmentJsonService(serilializedService);
            var serializedObject = serilializedService.SerializeFormData(testClass);

            var fragmentToUpdate = testClass.Owners.FirstOrDefault(o => o.Id == 2);
            testClass.Owners.Remove(fragmentToUpdate);
            fragmentToUpdate = updatedTestClass.Owners.FirstOrDefault(o => o.Id == 3);
            testClass.Owners.Add(fragmentToUpdate);
            var serializedFragmentObject = serilializedService.SerializeFormData(fragmentToUpdate);

            var expectedSerializedObject = serilializedService.SerializeFormData(testClass);

            var filterQuery = new KeyValuePair<string, string>("Id", "2");
            var result = dataFragmentService.UpdateFragment(serializedObject, serializedFragmentObject, "Owners", filterQuery);
            Assert.AreEqual(expectedSerializedObject, result);
        }
Пример #9
0
        public void UpdateFormDataFilteredArrayFragmentReturnsUpdatedSerializedStringTest()
        {
            var testClass        = GetTestClass();
            var updatedTestClass = GetUpdatedTestClass();

            var serilializedService = new JsonSerializationService();
            var dataFragmentService = new DataFragmentJsonService(serilializedService);
            var serializedObject    = serilializedService.SerializeFormData(testClass);

            var fragmentToUpdate = testClass.Owners.FirstOrDefault(o => o.Id == 2);

            testClass.Owners.Remove(fragmentToUpdate);
            fragmentToUpdate = updatedTestClass.Owners.FirstOrDefault(o => o.Id == 3);
            testClass.Owners.Add(fragmentToUpdate);
            var serializedFragmentObject = serilializedService.SerializeFormData(fragmentToUpdate);

            var expectedSerializedObject = serilializedService.SerializeFormData(testClass);

            var filterQuery = new KeyValuePair <string, string>("Id", "2");
            var result      = dataFragmentService.UpdateFragment(serializedObject, serializedFragmentObject, "Owners", filterQuery);

            Assert.AreEqual(expectedSerializedObject, result);
        }
        public void UpdateFormDataFragmentUpdateFragmentThrowsNotFoundExceptionTest()
        {
            var testClass = GetTestClass();
            var updatedTestClass = GetUpdatedTestClass();

            var serilializedService = new JsonSerializationService();
            var dataFragmentService = new DataFragmentJsonService(serilializedService);
            var serializedObject = serilializedService.SerializeFormData(testClass);
            var serializedFragmentObject = serilializedService.SerializeFormData(updatedTestClass.Owners);

            dataFragmentService.UpdateFragment(serializedObject, serializedFragmentObject, "InvalidFragmentName", new KeyValuePair<string, string>());
        }
        public void UpdateFormDataFragmentInvalidJsonThrowsUnsupportedOperationExceptionTest()
        {
            var testClass = GetTestClass();

            var serilializedService = new JsonSerializationService();
            var dataFragmentService = new DataFragmentJsonService(serilializedService);
            var serializedObject = serilializedService.SerializeFormData(testClass);
            const string serializedFragmentObject = "<xml>Not Json</xml>";

            dataFragmentService.UpdateFragment(serializedObject, serializedFragmentObject, "Owners", new KeyValuePair<string, string>());
        }
        public void UpdateFormDataFragmentUpdateFilteredFragmentThrowsNotFoundExceptionTest()
        {
            var testClass = GetTestClass();
            var updatedTestClass = GetUpdatedTestClass();

            var serilializedService = new JsonSerializationService();
            var dataFragmentService = new DataFragmentJsonService(serilializedService);
            var serializedObject = serilializedService.SerializeFormData(testClass);
            var serializedFragmentObject = serilializedService.SerializeFormData(updatedTestClass.Owners);
            var filterQuery = new KeyValuePair<string, string>("Id", "6");

            dataFragmentService.UpdateFragment(serializedObject, serializedFragmentObject, "Owners", filterQuery);
        }