BO4ETestProject/TestUserProperties.cs
/// <summary>
///     Tests to set and get a UserProperty
/// </summary>
Tests to set and get a UserProperty
Tests to set and get a UserProperty
[TestMethod]
        public void TestSetterGetter()
        {
            var melo = new Messlokation
            {
                MesslokationsId = "DE0123456789012345678901234567890",
                Sparte = Sparte.STROM
            };
            Assert.IsNull(melo.UserProperties);
            var value1 = "BarFoo";
            var value2 = "BigFoot";
            melo.SetUserProperty("foo", new Bar { FooBar = value1 });
            Assert.IsNotNull(melo.UserProperties);
            Assert.IsTrue(melo.UserProperties.TryGetValue("foo", out var upValue));
            Assert.IsInstanceOfType(upValue, typeof(Bar));
            Assert.AreEqual(value1, (upValue as Bar)?.FooBar);
            melo.SetUserProperty("foo", new Bar { FooBar = value2 });
            Assert.IsTrue(melo.UserProperties.TryGetValue("foo", out upValue));
            Assert.AreEqual(value2, (upValue as Bar)?.FooBar);
        }
[ TestMethod ] public void TestSetterGetter ( ) { var melo = new Messlokation { MesslokationsId = " " , Sparte = Sparte . STROM } ; Assert . IsNull ( melo . UserProperties ) ; var value1 = " " ; var value2 = " " ; melo . SetUserProperty ( " " , new Bar { FooBar = value1 } ) ; Assert . IsNotNull ( melo . UserProperties ) ; Assert . IsTrue ( melo . UserProperties . TryGetValue ( " " , out var upValue ) ) ; Assert . IsInstanceOfType ( upValue , typeof ( Bar ) ) ; Assert . AreEqual ( value1 , ( upValue as Bar ) ? . FooBar ) ; melo . SetUserProperty ( " " , new Bar { FooBar = value2 } ) ; Assert . IsTrue ( melo . UserProperties . TryGetValue ( " " , out upValue ) ) ; Assert . AreEqual ( value2 , ( upValue as Bar ) ? . FooBar ) ; }
Tests to set and get a UserProperty
Tests to set and get a UserProperty
// Update the value