Beispiel #1
0
        public void CanCallSetProperty()
        {
            var api      = new TestApi(serviceProvider);
            var name     = "TestValue183810822";
            var expected = "Test";

            api.SetProperty(name, expected);
            var result = api.GetProperty <string>(name);

            expected.Should().Be(result);
        }
Beispiel #2
0
        public void CanCallGetPropertyWithApiBaseAndString()
        {
            var api      = new TestApi(serviceProvider);
            var name     = "TestValue183810822";
            var expected = "Test";

            api.SetProperty(name, expected);
            var result = api.GetProperty(name);

            expected.Should().Be(result as string);
        }
Beispiel #3
0
        public void PropertyBagManipulatesPropertiesCorrectly()
        {
            var context = new TestApi().Context;

            Assert.False(context.HasProperty("Test"));
            Assert.Null(context.GetProperty("Test"));
            Assert.Null(context.GetProperty <string>("Test"));
            Assert.Equal(default(int), context.GetProperty <int>("Test"));

            context.SetProperty("Test", "Test");
            Assert.True(context.HasProperty("Test"));
            Assert.Equal("Test", context.GetProperty("Test"));
            Assert.Equal("Test", context.GetProperty <string>("Test"));

            context.ClearProperty("Test");
            Assert.False(context.HasProperty("Test"));
            Assert.Null(context.GetProperty("Test"));
            Assert.Null(context.GetProperty <string>("Test"));
            Assert.Equal(default(int), context.GetProperty <int>("Test"));
        }