public void SetUp()
        {
            skype = MockRepository.GenerateMock<ISkype>();
            chat = MockRepository.GenerateMock<IChat>();
            userCollection = MockRepository.GenerateMock<IUserCollection>();
            client = MockRepository.GenerateMock<IClient>();
            user = MockRepository.GenerateMock<IUser>();
            configurationLoader = new ConfigurationLoader();
            httpGet = MockRepository.GenerateMock<IHttpGet>();
            chats = MockRepository.GenerateMock<IChats>();
            messengerClient = new MessengerClient(skype, userCollection, chats);

            buildCollection = MockRepository.GenerateMock<IBuildCollection>();
            loader = new Loader(messengerClient, buildCollection);
            stopper = MockRepository.GenerateMock<IStopper>();
            controller = new Controller();
            controller.Container.Kernel.AddComponentInstance<ISkype>(skype);
            controller.Container.Kernel.AddComponentInstance<IUserCollection>(userCollection);
            controller.Container.Kernel.AddComponentInstance<IStopper>(stopper);
            controller.CcTrayUrl = "http://localhost/Cctray.xml";
            controller.CcTrayUsername = "******";
            controller.CcTrayPassword = "******";
            controller.HttpTimeout = 30;
            controller.Configuration = @"RealUsers.xml";
        }
Пример #2
0
 public void As_an_unknown_skype_user_I_want_to_have_an_error_message_when_configuration_is_loaded()
 {
     var skype = new Skype(makeMessageProcessor());
     var chats = new Chats(skype);
     var configurationLoader = new ConfigurationLoader();
     var loader = new Loader(new MessengerClient(skype, new UserCollection(new SKYPE4COMLib.UserCollection()), chats),new BuildCollection());
     Assert.Throws<UserNotKnowException>(() => loader.GetUserGroups(configurationLoader.Load("UnknownUserPipeline.xml")));
 }
Пример #3
0
 public void should_save_configuration()
 {
     var config = new Configuration();
     var path = Guid.NewGuid().ToString();
     var configurationLoader = new ConfigurationLoader();
     configurationLoader.Save(config, path);
     var xml = File.ReadAllText(path);
     Assert.That(xml, Is.EqualTo("<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Configuration xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" />"));
 }
Пример #4
0
 public void Should_load_configration()
 {
     var configurationLoader = new ConfigurationLoader();
     var config = configurationLoader.Load(@"Testdata\config\OnePipeline.xml");
     Assert.That(config.Items.Length, Is.EqualTo(1));
     Assert.That(config.Items[0].name, Is.EqualTo("Trumps"));
     Assert.That(config.Items[0].users.Length, Is.EqualTo(2));
     Assert.That(config.Items[0].users[0].skypeName, Is.EqualTo("dave"));
     Assert.That(config.Items[0].users[1].skypeName, Is.EqualTo("fish"));
 }
Пример #5
0
        public void As_A_user_I_want_to_have_a_message_when_a_build_fails_so_that_I_can_fix_the_build()
        {
            var message = "someMessage - " + Guid.NewGuid().ToString();
            var skype = new Skype(makeMessageProcessor());
            var chats = new Chats(skype);
            var configurationLoader = new ConfigurationLoader();
            var loader = new Loader(new MessengerClient(skype, new UserCollection(new SKYPE4COMLib.UserCollection()), chats), new BuildCollection());
            var projectwatcher = new Projectwatcher(loader.GetUserGroups(configurationLoader.Load("OnePipeline.xml")));

            string url = "someUrl";

            var httpGet = MockRepository.GenerateMock<IHttpGet>();
            httpGet.Expect(x => x.Request(url));
            httpGet.Expect(x => x.StatusCode).Return(200);
            httpGet.Expect(x => x.ResponseBody).Return(File.ReadAllText("cctray.xml"));

            ICcTray ccTray = new CcTray(new EndpointImpl(httpGet, url));
            ccTray.Load();

            //Test
            projectwatcher.Message(ccTray.FailedPipelines());
        }
Пример #6
0
        public void As_A_user_I_want_to_two_messages_in_the_same_group_window_when_a_build_fails_so_that_I_can_fix_the_builds_when_each_fails()
        {
            var skype = new Skype(makeMessageProcessor());
            var chats = new Chats(skype);
            var configurationLoader = new ConfigurationLoader();
            var loader = new Loader(new MessengerClient(skype, new UserCollection(new SKYPE4COMLib.UserCollection()), chats),new BuildCollection());
            var projectwatcher = new Projectwatcher(loader.GetUserGroups(configurationLoader.Load("OnePipeline.xml")));

            string url = "someUrl";

            var httpGet = MockRepository.GenerateMock<IHttpGet>();
            httpGet.Expect(x => x.Request(url));
            httpGet.Expect(x => x.StatusCode).Return(200);
            httpGet.Expect(x => x.ResponseBody).Return(File.ReadAllText("cctray.xml"));

            ICcTray ccTray = new CcTray(new EndpointImpl(httpGet, url));
            ccTray.Load();

            //Test
            projectwatcher.Message(ccTray.FailedPipelines());

            var p = new Project("Trunk_QA_Env_PCIDSS :: Deployment_to_QA_PCIDSS1", "Failed", "Failure", "1.2.3.4","2011-09-23T16:59:18", "web");
            ccTray.FailedPipelines().Add(p);
            projectwatcher.Message(ccTray.FailedPipelines());

            projectwatcher.Message(ccTray.FailedPipelines());
        }