public void RemoveFormDataFragmentInvalidJsonThrowsUnsupportedOperationExceptionTest()
        {
            var          serilializedService = new JsonSerializationService();
            var          dataFragmentService = new DataFragmentJsonService(serilializedService);
            const string serializedObject    = "<xml>Not Json</xml>";

            dataFragmentService.RemoveFragment(serializedObject, "Owners", new KeyValuePair <string, string>());
        }
        public void RemoveFormDataFragmentThrowsNotFoundExceptionTest()
        {
            var testClass = GetTestClass();

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

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

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

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

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

            dataFragmentService.RemoveFragment(serializedObject, "Owners", filterQuery);
        }
        public void RemoveFormDataArrayFragmentReturnsUpdatedSerializedStringTest()
        {
            var testClass = GetTestClass();

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

            var result = dataFragmentService.RemoveFragment(serializedObject, "Owners", new KeyValuePair<string, string>());
            Assert.AreNotEqual(serializedObject.Length, result.Length);
        }
        public void RemoveFormDataFragmentReturnsSerializedStringTest()
        {
            var testClass = GetTestClass();

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

            var result = dataFragmentService.RemoveFragment(serializedObject, "Owners", new KeyValuePair<string, string>());
            Assert.IsInstanceOfType(result, typeof(string));
        }
        public void RemoveFormDataArrayFragmentReturnsUpdatedSerializedStringTest()
        {
            var testClass = GetTestClass();

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

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

            Assert.AreNotEqual(serializedObject.Length, result.Length);
        }
        public void RemoveFormDataFragmentReturnsSerializedStringTest()
        {
            var testClass = GetTestClass();

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

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

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

            var serilializedService = new JsonSerializationService();
            var dataFragmentService = new DataFragmentJsonService(serilializedService);
            var serializedObject = serilializedService.SerializeFormData(testClass);
            var fragmentToRemove = testClass.Owners.FirstOrDefault(a => a.Id == 2);
            testClass.Owners.Remove(fragmentToRemove);

            var expectedFragmentserializedObject = serilializedService.SerializeFormData(testClass);
            var filterQuery = new KeyValuePair<string, string>("Id", "2");

            var result = dataFragmentService.RemoveFragment(serializedObject, "Owners", filterQuery);
            Assert.AreEqual(expectedFragmentserializedObject, result);
        }
        public void RemoveFormDataFilteredArrayFragmentReturnsUpdatedSerializedStringTestTest()
        {
            var testClass = GetTestClass();

            var serilializedService = new JsonSerializationService();
            var dataFragmentService = new DataFragmentJsonService(serilializedService);
            var serializedObject    = serilializedService.SerializeFormData(testClass);
            var fragmentToRemove    = testClass.Owners.FirstOrDefault(a => a.Id == 2);

            testClass.Owners.Remove(fragmentToRemove);

            var expectedFragmentserializedObject = serilializedService.SerializeFormData(testClass);
            var filterQuery = new KeyValuePair <string, string>("Id", "2");

            var result = dataFragmentService.RemoveFragment(serializedObject, "Owners", filterQuery);

            Assert.AreEqual(expectedFragmentserializedObject, result);
        }
        public void RemoveFormDataFragmentFilteredThrowsNotFoundExceptionTest()
        {
            var testClass = GetTestClass();

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

            dataFragmentService.RemoveFragment(serializedObject, "Owners", filterQuery);
        }
        public void RemoveFormDataFragmentInvalidJsonThrowsUnsupportedOperationExceptionTest()
        {
            var serilializedService = new JsonSerializationService();
            var dataFragmentService = new DataFragmentJsonService(serilializedService);
            const string serializedObject = "<xml>Not Json</xml>";

            dataFragmentService.RemoveFragment(serializedObject, "Owners", new KeyValuePair<string, string>());
        }