Esempio n. 1
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")));
 }
Esempio n. 2
0
 public void Should_get_new_chat()
 {
     var name = Guid.NewGuid().ToString();
     var userCol = MockRepository.GenerateMock<IUserCollection>();
     var chatMock = MockRepository.GenerateMock<IChat>();
     skype.Expect(x => x.CreateChatMultiple(userCol, name)).Return(chatMock);
     var chats = new Chats(skype);
     var chat = chats.Get(name, userCol);
     Assert.That(chat, Is.Not.Null);
     skype.VerifyAllExpectations();
 }
Esempio n. 3
0
 public void Should_get_exsisting_chat()
 {
     var name = Guid.NewGuid().ToString();
     var userCol = MockRepository.GenerateMock<IUserCollection>();
     skype.Expect(x => x.CreateChatMultiple(userCol, name)).Repeat.Once();
     var chats = new Chats(skype);
     var chat = chats.Get(name, userCol);
     //Test
     var chat1 = chats.Get(name, userCol);
     //Assert
     Assert.That(chat1, Is.Not.Null);
     skype.VerifyAllExpectations();
 }
Esempio n. 4
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());
        }
Esempio n. 5
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());
        }