Пример #1
0
        /// <exception cref="System.Exception"/>
        public virtual void TestAddUninitedSiblingInStart()
        {
            CompositeService parent  = new CompositeService("parent");
            BreakableService sibling = new BreakableService();

            parent.AddService(new TestCompositeService.AddSiblingService(parent, sibling, Service.STATE
                                                                         .Started));
            parent.Init(new Configuration());
            AssertInState(Service.STATE.Notinited, sibling);
            parent.Start();
            parent.Stop();
            Assert.Equal("Incorrect number of services", 2, parent.GetServices
                             ().Count);
        }
Пример #2
0
        /// <exception cref="System.Exception"/>
        public virtual void TestAddUninitedSiblingInInit()
        {
            CompositeService parent  = new CompositeService("parent");
            BreakableService sibling = new BreakableService();

            parent.AddService(new TestCompositeService.AddSiblingService(parent, sibling, Service.STATE
                                                                         .Inited));
            parent.Init(new Configuration());
            try
            {
                parent.Start();
                NUnit.Framework.Assert.Fail("Expected an exception, got " + parent);
            }
            catch (ServiceStateException)
            {
            }
            //expected
            parent.Stop();
            Assert.Equal("Incorrect number of services", 2, parent.GetServices
                             ().Count);
        }