Beispiel #1
0
        public async void BrowseAsyncItem()
        {
            SDK.Common.Item         searchItem = new SDK.Common.Item();
            IList <SDK.Common.Item> items      = await mockProvider.BrowseAsync(searchItem);

            Assert.Empty(items);
        }
Beispiel #2
0
        public void UnSubscribeNotSubscribed()
        {
            SDK.Common.Item item = new SDK.Common.Item("test");

            Action <object> action = (object obj) => { };

            itemProvider.Object.UnSubscribe(item, action);

            Assert.Empty(itemProvider.Object.Subscriptions);
        }
Beispiel #3
0
        public void Subscribe()
        {
            SDK.Common.Item item = new SDK.Common.Item("test");

            Action <object> action = (object obj) => { };

            Assert.Empty(itemProvider.Object.Subscriptions);

            bool result = itemProvider.Object.Subscribe(item, action);

            Assert.True(result);
            Assert.Equal(1, itemProvider.Object.Subscriptions.Count);
            Assert.Equal(1, itemProvider.Object.Subscriptions[item].Count);
        }
Beispiel #4
0
        public void SubscribeDuplicateSubscription()
        {
            SDK.Common.Item item   = new SDK.Common.Item("test");
            Action <object> action = (object obj) => { };

            Assert.Empty(itemProvider.Object.Subscriptions);

            bool result = itemProvider.Object.Subscribe(item, action);

            Assert.True(result);

            result = itemProvider.Object.Subscribe(item, action);

            Assert.False(result);
        }
Beispiel #5
0
        public void PrintModel()
        {
            Target target = new ConsoleTarget();

            LogManager.Configuration.AddTarget("test", target);
            LogManager.Configuration.AddRule(LogLevel.Trace, LogLevel.Fatal, target);
            Logger logger = LogManager.GetLogger("test");

            SDK.Common.Item root   = new SDK.Common.Item("Root");
            SDK.Common.Item child1 = new SDK.Common.Item("Child1");
            SDK.Common.Item child2 = new SDK.Common.Item("Child2");

            root.AddChild(child1);
            root.AddChild(child2);

            Utility.PrintModel(logger, root, 0);
        }
Beispiel #6
0
 /// <summary>
 ///     Asynchronously reads and returns the current value of the specified <see cref="Item"/>
 /// </summary>
 /// <param name="item">The Item to read.</param>
 /// <returns>The value of the specified Item.</returns>
 public override async Task <object> ReadAsync(SDK.Common.Item item)
 {
     return(await Task.Run(() => Read(item)));
 }
Beispiel #7
0
 /// <summary>
 ///     Reads and returns the current value of the specified <see cref="Item"/>.
 /// </summary>
 /// <param name="item">The Item to read.</param>
 /// <returns>The value of the specified Item.</returns>
 public override object Read(SDK.Common.Item item)
 {
     return(1);
 }
Beispiel #8
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="MockItemProvider"/> class.
 /// </summary>
 /// <param name="providerName">The name of the Item Provider.</param>
 public MockItemProvider(string providerName)
     : base(providerName)
 {
     ItemRoot = new SDK.Common.Item("Root");
     ItemRoot.AddChild(new SDK.Common.Item("Child"));
 }
Beispiel #9
0
        public void FindRoot()
        {
            SDK.Common.Item item = mockProvider.Find("Root");

            Assert.NotNull(item);
        }
Beispiel #10
0
        public void FindNotFound()
        {
            SDK.Common.Item item = mockProvider.Find("NotFound");

            Assert.Null(item);
        }
Beispiel #11
0
        public void FindFound()
        {
            SDK.Common.Item item = mockProvider.Find("Root.Child");

            Assert.Equal("Root.Child", item.ToString());
        }
Beispiel #12
0
        public async void FindAsync()
        {
            SDK.Common.Item item = await mockProvider.FindAsync("test");

            Assert.Null(item);
        }
Beispiel #13
0
        public void BrowseItem()
        {
            SDK.Common.Item item = new SDK.Common.Item();

            Assert.Empty(mockProvider.Browse(item));
        }
Beispiel #14
0
        public async void BrowseAsync()
        {
            SDK.Common.Item item = await mockProvider.BrowseAsync();

            Assert.Equal("Root", item.ToString());
        }
Beispiel #15
0
 public void Browse()
 {
     SDK.Common.Item item = mockProvider.Browse();
     Assert.Equal("Root", item.ToString());
 }