public void Should_message_a_single_group_where_the_pipeline_names_match() { var message = "build failed"; var userGroups = MockRepository.GenerateMock<IUserGroups>(); var project = new Project("ABC", "Failed", "Failed", "Failed", "10:20", "http://some.place"); userGroups.Expect(x => x.Alert(project)); var list = new List<Project>(); list.Add(project); var projectwatcher = new Projectwatcher(userGroups); //Test projectwatcher.Message(list); //Assert userGroups.VerifyAllExpectations(); }
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()); }
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()); }
public void Should_send_a_multiple_message_sucessfully_mocking_http_and_skype() { var message = "Trunk_QA_Env_PCIDSS has Failure build 03.13.00.207 http://build.london.ttldev.local:8153/go/pipelines/Trunk_QA_Env_PCIDSS/34/Deployment_to_QA_PCIDSS/1"; var name = "Trunk_QA_Env_PCIDSS"; var projects = TestData.CreateProjects(10, 1); client.Expect(x => x.IsRunning()).Return(true); chats.Expect(x => x.Get(name, userCollection)).Return(chat); skype.Expect(x => x.SkypeClient()).Return(client); skype.Expect(x => x.GetUsers()).Return(new List<string> { "owainfperry" }); skype.Expect(x => x.GetUser("owainfperry")).IgnoreArguments().Return(user).Repeat.Once(); skype.Expect(x => x.GetUser("otherUser")).IgnoreArguments().Return(user).Repeat.Once(); chat.Expect(x => x.OpenWindow()); chat.Expect(x => x.SendMessage(message)); userCollection.Expect(x => x.Add(user)).IgnoreArguments(); var config = configurationLoader.Load("MockOnePipeline.xml"); var userGroups = loader.GetUserGroups(config); var projectwatcher = new Projectwatcher(userGroups); string url = "someUrl"; HttpClientReadXml(url, TestData.MakeXml(projects)); ICcTray ccTray = new CcTray(new EndpointImpl(httpGet, url)); ccTray.Load(); //ccTray.FailedPipelines.Add(new Project("a1", "Failed", "broken", "label", "10:20", "a.b")); //Test projectwatcher.Message(ccTray.FailedPipelines()); projectwatcher.Message(ccTray.FailedPipelines()); }