Esempio n. 1
0
        public void LoadServiceTest()
        {
            // arrange
            var client = new MuffinClient(new TypeCatalog(typeof(ServiceTester)));

            // act
            client.Start();

            // assert
            Assert.IsTrue(client.ServiceLoader.OfType<ServiceTester>().Any());
        }
Esempio n. 2
0
        public void LoadServiceTest()
        {
            // arrange
            var client = new MuffinClient(new TypeCatalog(typeof(ServiceTester)));

            // act
            client.Start();

            // assert
            Assert.IsTrue(client.ServiceLoader.OfType <ServiceTester>().Any());
        }
Esempio n. 3
0
        public void LoadPlatformTest()
        {
            // arrange
            var client = new MuffinClient(new TypeCatalog(typeof(PlatformTester)));

            // act
            client.Start();

            // assert
            Assert.IsTrue(client.PlatformLoader.OfType<PlatformTester>().Any());
        }
Esempio n. 4
0
        public void PlatformArgsTest()
        {
            // arrange
            var client = new MuffinClient(new TypeCatalog(typeof(PlatformTester)));
            client.Start();

            // act
            var platform = client.PlatformLoader.Get<PlatformTester>();

            // assert
            Assert.IsNotNull(platform.TestPlatformLoader);
        }
Esempio n. 5
0
        public void ServiceArgsTest()
        {
            // arrange
            var client = new MuffinClient(new TypeCatalog(typeof(ServiceTester)));
            client.Start();

            // act
            var service = client.ServiceLoader.Get<ServiceTester>();

            // assert
            Assert.IsNotNull(service.TestServiceLoader);
            Assert.IsNotNull(service.TestPlatformLoader);
        }
Esempio n. 6
0
        // Not every Muffin/Service/Protocol has basic tasks to do, some of them might
        // need to be split in smaller separate parts that work together.
        // This sample contains three examples for how to use Parts to have multiple
        // classes work together.
        static void Main()
        {
            var client = new MuffinClient();

            client.Start();

            Console.WriteLine("Press enter to exit...");
            Console.ReadLine();

            // Calling Dispose here will also dispose all loaded MuffinParts
            // automatically. There is no need to dispose them manually.
            client.Dispose();
        }
Esempio n. 7
0
        public void MuffinArgsTest()
        {
            // arrange
            var client = new MuffinClient(new TypeCatalog(typeof(MuffinTester)));
            client.Start();

            // act
            var muffin = client.MuffinLoader.Get<MuffinTester>();

            // assert
            Assert.IsNotNull(muffin.TestMuffinLoader);
            Assert.IsNotNull(muffin.TestServiceLoader);
            Assert.IsNotNull(muffin.TestPlatformLoader);
        }
        public void Constructor2Test()
        {
            // arrange
            var catalog = new AggregateCatalog();

            // act
            var client = new MuffinClient(catalog);

            // assert
            Assert.IsNotNull(client.MuffinLoader);
            Assert.IsNotNull(client.ServiceLoader);
            Assert.IsNotNull(client.PlatformLoader);
            Assert.AreSame(catalog, client.AggregateCatalog);
        }
Esempio n. 9
0
        public void ServiceArgsTest()
        {
            // arrange
            var client = new MuffinClient(new TypeCatalog(typeof(ServiceTester)));

            client.Start();

            // act
            var service = client.ServiceLoader.Get <ServiceTester>();

            // assert
            Assert.IsNotNull(service.TestServiceLoader);
            Assert.IsNotNull(service.TestPlatformLoader);
        }
        public void Constructor4Test()
        {
            // arrange

            // act
            var client = new MuffinClient(new ComposablePartCatalog[] {});

            // assert
            Assert.IsNotNull(client.MuffinLoader);
            Assert.IsNotNull(client.ServiceLoader);
            Assert.IsNotNull(client.PlatformLoader);

            Assert.IsNotNull(client.AggregateCatalog);
            Assert.AreEqual(0, client.AggregateCatalog.Catalogs.Count);
        }
Esempio n. 11
0
        public void MuffinArgsTest()
        {
            // arrange
            var client = new MuffinClient(new TypeCatalog(typeof(MuffinTester)));

            client.Start();

            // act
            var muffin = client.MuffinLoader.Get <MuffinTester>();

            // assert
            Assert.IsNotNull(muffin.TestMuffinLoader);
            Assert.IsNotNull(muffin.TestServiceLoader);
            Assert.IsNotNull(muffin.TestPlatformLoader);
        }
        public void Constructor3Test()
        {
            // arrange
            var catalog1 = new TypeCatalog();
            var catalog2 = new TypeCatalog();

            // act
            var client = new MuffinClient(catalog1, catalog2);

            // assert
            Assert.IsNotNull(client.MuffinLoader);
            Assert.IsNotNull(client.ServiceLoader);
            Assert.IsNotNull(client.PlatformLoader);

            Assert.IsNotNull(client.AggregateCatalog);
            Assert.AreEqual(2, client.AggregateCatalog.Catalogs.Count);
        }
        public void DoubleStartTest()
        {
            // arrange
            InvalidOperationException expectedException = null;
            var client = new MuffinClient(new AggregateCatalog());
            client.Start();

            // act
            try
            {
                // try to start the client a second time...
                client.Start();
            }
            catch (InvalidOperationException ex)
            {
                expectedException = ex;
            }

            // assert
            Assert.IsNotNull(expectedException);
        }