Пример #1
0
        private static void FillUiWithImportedTest(BindableCollection <ResourcePropertyModel> testProperties4Debug, PropertyBag test)
        {
            if (test == null)
            {
                return;
            }

            var defaultType = string.Empty;

            if (test.HasProperty(Constants.Type))
            {
                defaultType = test.GetProperty <string>(Constants.Type);
                System.Diagnostics.Trace.TraceInformation("----- FillUiWithImportedTest: defaultType = {0}\n", defaultType);
            }


            testProperties4Debug.Clear();
            int i = 1;

            foreach (
                var prop in
                test.GetAllProperties()
                .SelectMany(p => GetResourcePropertyModel(test, p, defaultType))
                .OrderBy(m => m.ResourceType))
            {
                if (prop.Key != Constants.Type)
                {
                    System.Diagnostics.Trace.TraceInformation("----- FillUiWithImportedTest: {0} {1} = {2}", i++, prop.Key, prop.Value);
                    testProperties4Debug.Add(prop);
                }
            }
        }
Пример #2
0
            public void ReturnsAllRegisteredPropertiesWithCorrectValues()
            {
                var propertyBag = new PropertyBag();
                propertyBag.SetPropertyValue("FirstProperty", 1);
                propertyBag.SetPropertyValue("SecondProperty", "test");

                var allProperties = propertyBag.GetAllProperties().ToList();

                Assert.AreEqual(2, allProperties.Count);

                Assert.AreEqual("FirstProperty", allProperties[0].Key);
                Assert.AreEqual(1, allProperties[0].Value);

                Assert.AreEqual("SecondProperty", allProperties[1].Key);
                Assert.AreEqual("test", allProperties[1].Value);
            }
Пример #3
0
            public void ReturnsAllRegisteredPropertiesWithCorrectValues()
            {
                var propertyBag = new PropertyBag();

                propertyBag.SetPropertyValue("FirstProperty", 1);
                propertyBag.SetPropertyValue("SecondProperty", "test");

                var allProperties = propertyBag.GetAllProperties().ToList();

                Assert.AreEqual(2, allProperties.Count);

                Assert.AreEqual("FirstProperty", allProperties[0].Key);
                Assert.AreEqual(1, allProperties[0].Value);

                Assert.AreEqual("SecondProperty", allProperties[1].Key);
                Assert.AreEqual("test", allProperties[1].Value);
            }