Exemplo n.º 1
0
        private static MessengerFactory InitFactory()
        {
            var factory = new MessengerFactory();

            factory.Registry(Constants.Skype, identity => new SkypeMessenger(identity, new SkypeClient()));
            factory.Registry(Constants.Viber, identity => new ViberMessenger(identity, new ViberClient()));
            return(factory);
        }
Exemplo n.º 2
0
        public void ShouldReturnNewInstanceWhenTypeIsRegistred()
        {
            factory.Registry(TestMessenger, identity => new TestMessenger());
            var identity  = this.createIdentity();
            var messenger = factory.GetMessenger(TestMessenger, identity);

            Assert.AreEqual(typeof(TestMessenger), messenger.GetType());
        }