Exemplo n.º 1
0
        public void TestTryGetValueReturnFalse()
        {
            var bag = new LazyPropertyHolderBase();

            var propertyName = "Property-Name";

            bag.TryGetValue <int>(propertyName, out _).IsFalse();

            bag.SetValue(propertyName, 1);
            bag.TryGetValue <int>(propertyName, out _).IsTrue();
            bag.TryGetValue <string>(propertyName, out _).IsFalse();
        }
Exemplo n.º 2
0
        public void TestCurdWithSortOfDataTypes <T>(T value)
        {
            var propertyName = "Property-" + (value?.ToString() ?? "null");

            var bag = new LazyPropertyHolderBase();

            bag.SetValue(propertyName, value).Is(true);
            bag.PropertiesCount.Is(1);

            bag.GetValue <T>(propertyName).Is(value);
            bag.Properties.Is(new KeyValuePair <string, object>[] {
                new KeyValuePair <string, object>(propertyName, value),
            });

            bag.TryGetValue(propertyName, out T obtainedValue).Is(true);
            obtainedValue.Is(value);

            bag.DeleteProperty <T>(propertyName).Is(true);
            bag.PropertiesCount.Is(0);
        }