Esempio n. 1
0
        public void TestProviderModel_SimpleManager_BasicProductBehavior1()
        {
            var manager = new Tug.TestExt.SimpleThingyProviderManager();
            var prov    = manager.GetProvider(manager.FoundProvidersNames.First());
            var prod    = prov.Produce();

            Assert.IsFalse(prod.IsDisposed);
            prod.Dispose();
            Assert.IsTrue(prod.IsDisposed);
        }
Esempio n. 2
0
        public void TestProviderModel_SimpleManager_BasicProductBehavior2()
        {
            var value   = "foobar";
            var manager = new Tug.TestExt.SimpleThingyProviderManager();
            var prov    = manager.GetProvider(manager.FoundProvidersNames.First());
            var prod    = prov.Produce();

            Assert.IsFalse(prod.IsDisposed);
            prod.SetThing(value);
            Assert.AreEqual(value, prod.GetThing());
            prod.Dispose();
            Assert.IsTrue(prod.IsDisposed);
        }
Esempio n. 3
0
        public void TestProviderModel_SimpleManager_BasicProviderDetails()
        {
            var manager = new Tug.TestExt.SimpleThingyProviderManager();
            var prov    = manager.GetProvider(manager.FoundProvidersNames.First());

            Assert.IsNotNull(prov, message: "get first provider");

            var provInfo = prov.Describe();

            Assert.IsNotNull(provInfo,
                             message: "get provider details");
            var provParamsInfo = prov.DescribeParameters();

            Assert.IsNotNull(provParamsInfo,
                             message:  "get provider parameter details");
            Assert.IsTrue(provParamsInfo.Count() > 0,
                          message:  "get provider parameter details has at least one");
            Assert.IsFalse(provParamsInfo.All(x => string.IsNullOrEmpty(x.Name)),
                           message:  "get provider parameter details all have names");
        }
Esempio n. 4
0
        public void TestProviderModel_SimpleManager_BasicProductBehavior3()
        {
            var value   = "foobar";
            var prefix  = "Before<";
            var suffix  = ">After";
            var manager = new Tug.TestExt.SimpleThingyProviderManager();
            var prov    = manager.GetProvider(manager.FoundProvidersNames.First());

            prov.SetParameters(new Dictionary <string, object>
            {
                ["Prefix"] = prefix,
                ["Suffix"] = suffix,
            });

            var prod = prov.Produce();


            Assert.IsFalse(prod.IsDisposed);
            prod.SetThing(value);
            Assert.AreEqual($"{prefix}{value}{suffix}", prod.GetThing());
            prod.Dispose();
            Assert.IsTrue(prod.IsDisposed);
        }