Exemplo n.º 1
0
        public void InputOutputMappingViewModel_MapsTo_ChangedToEmptyAndRequiredIsTrue_RequireMissingTrue()
        {
            //------------Setup for test--------------------------
            var viewModel = InputOutputViewModelFactory.CreateInputOutputViewModel("testName", "testValue", "newValue", "", true, "");

            Assert.IsTrue(viewModel.Required);
            Assert.IsFalse(viewModel.RequiredMissing);

            //------------Execute Test---------------------------
            viewModel.MapsTo = "";

            //------------Assert Results-------------------------
            Assert.IsTrue(viewModel.Required);
            Assert.IsTrue(viewModel.RequiredMissing);
        }
Exemplo n.º 2
0
        public void InputOutputMappingViewModel_MapsTo_ChangedToEmptyAndRequiredIsFalse_RequireMissingFalse()
        {
            //------------Setup for test--------------------------
            var viewModel = InputOutputViewModelFactory.CreateInputOutputViewModel(name: "testName", value: "testValue", mapsTo: "newValue", defaultValue: "", required: false, recordSetName: "");

            Assert.IsFalse(viewModel.Required);
            Assert.IsFalse(viewModel.RequiredMissing);

            //------------Execute Test---------------------------
            viewModel.MapsTo = "";

            //------------Assert Results-------------------------
            Assert.IsFalse(viewModel.Required);
            Assert.IsFalse(viewModel.RequiredMissing);
        }
Exemplo n.º 3
0
        public void InputOutputMappingViewModel_MapsTo_UpdateDataListWithJsonObject_IsObject()
        {
            var testEnvironmentModel = ResourceModelTest.CreateMockEnvironment();

            var _resourceModel = new ResourceModel(testEnvironmentModel.Object)
            {
                ResourceName = "test",
                ResourceType = ResourceType.Service,
                DataList     = @"
                            <DataList>
                                    <Scalar/>
                                    <Country/>
                                    <State />
                                    <City>
                                        <Name/>
                                        <GeoLocation />
                                    </City>
                             </DataList>
                            "
            };

            IDataListViewModel setupDatalist = new DataListViewModel();

            DataListSingleton.SetDataList(setupDatalist);
            DataListSingleton.ActiveDataList.InitializeDataListViewModel(_resourceModel);

            //------------Setup for test--------------------------
            var viewModel = InputOutputViewModelFactory.CreateInputOutputViewModel("testName", "[[@objName]]", "", "", false, "");

            Assert.IsFalse(viewModel.Required);
            Assert.IsFalse(viewModel.RequiredMissing);

            //------------Execute Test---------------------------
            viewModel.IsObject = true;
            const string jsonString = "{\"Name\":\"\",\"Age\":\"\",\"School\":[{\"Name\":\"\",\"Location\":\"\"}],\"Gender\":\"\"}";

            viewModel.JsonString = jsonString;

            //------------Assert Results-------------------------
            Assert.IsFalse(viewModel.Required);
            Assert.IsFalse(viewModel.RequiredMissing);
        }
Exemplo n.º 4
0
 void SetInputOutputMappingViewModelFromTestMappingObject(InputOutputViewModelTestObject mappingObject)
 {
     _inputOutputViewModel = InputOutputViewModelFactory.CreateInputOutputViewModel(mappingObject.Name, mappingObject.Value, mappingObject.MapsTo, mappingObject.DefaultValue, mappingObject.Required, mappingObject.RecordSetName);
 }