public void Refresh_Returns_Model_With_Passed_Pipeline_Count() { var expectedPipelines = new List<DisplayablePipeline> { new DisplayablePipeline("Shared", "bob"){Stages = new List<IStage>(){new PassedStage("", "", DateTime.Now.ToString())}}, new DisplayablePipeline("Shared2", "bob2"){Stages = new List<IStage>(){new FailedStage("", "", DateTime.Now.ToString())}}, new DisplayablePipeline("Shared3", "bob3"){Stages = new List<IStage>(){new PassedStage("", "", DateTime.Now.ToString())}} }; var homeController = new HomeController(new FakeDashboard(expectedPipelines), new FakeXmlProfileLoader()); var result = (ViewResult)homeController.Refresh(""); var viewModel = (IndexViewModel)result.ViewData.Model; Assert.That(viewModel.PassedCount, Is.EqualTo(2)); }
public void Should_Filter_Refresh_Based_On_Profile_Name() { var expectedPipelines = new List<DisplayablePipeline> { new DisplayablePipeline("Shared", "bob"){Stages = new List<IStage>(){new FailedStage("","",DateTime.Now.ToString())}}, new DisplayablePipeline("Shared2", "bob"){Stages = new List<IStage>(){new PassedStage("","",DateTime.Now.ToString())}}, new DisplayablePipeline("Shared3", "bob"){Stages = new List<IStage>(){new FailedStage("","",DateTime.Now.ToString())}} }; const string profilesXmlFile = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" + "<Profiles>" + "<Profile name=\"test\">" + "<WhiteList>" + "<Pipeline>Shared</Pipeline>" + "<Pipeline>Shared2</Pipeline>" + "<Pipeline>Shared3</Pipeline>" + "</WhiteList>" + "<Statuses><Failed/><Passed/></Statuses>" + "</Profile></Profiles>"; var fakeFileLoader = new FakeFileLoader(profilesXmlFile); IXmlProfileRetriever xmlProfileRetriever = new XmlProfileRetriever(fakeFileLoader); var homeController = new HomeController(new FakeDashboard(expectedPipelines), xmlProfileRetriever); var result = (ViewResult)homeController.Refresh("test"); var viewModel = (IndexViewModel)result.ViewData.Model; var pipelines = viewModel.Pipelines; Assert.That(pipelines.Count(), Is.EqualTo(3)); var pipeline = pipelines.First(); Assert.That(pipeline.Name, Is.EqualTo("Shared")); }
public void Should_Show_Passed_Count() { var expectedPipelines = new List<DisplayablePipeline> { new DisplayablePipeline("Shared", "bob"){Stages = new List<IStage>{new FailedStage("","",DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss"))}}, new DisplayablePipeline("Shared2", "bob"){Stages = new List<IStage>{new PassedStage("","",DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss"))}}, new DisplayablePipeline("Shared3", "bob"){Stages = new List<IStage>{new FailedStage("","",DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss"))}}, new DisplayablePipeline("Shared4", "bob"){Stages = new List<IStage>{new PassedStage("","",DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss"))}} }; const string ProfilesXmlFile = "<?xml version=\"1.0\" encoding=\"utf-8\" ?><Profiles><Profile name=\"test\">" + "<WhiteList><Pipeline>Pipeline1</Pipeline><Pipeline>Pipeline2</Pipeline><Pipeline>Pipeline3</Pipeline><Pipeline>Pipeline4</Pipeline></WhiteList>" + "<Statuses><Failed/><Passed/></Statuses>" + "<ShowPassedCount>true</ShowPassedCount>" + "</Profile></Profiles>"; var fakeFileLoader = new FakeFileLoader(ProfilesXmlFile); IXmlProfileRetriever xmlProfileRetriever = new XmlProfileRetriever(fakeFileLoader); var homeController = new HomeController(new FakeDashboard(expectedPipelines), xmlProfileRetriever); var result = (ViewResult)homeController.Refresh("test"); var viewModel = (IndexViewModel)result.ViewData.Model; Assert.That(viewModel.ShowPassedCount, Is.EqualTo(true)); }
public void IndexReturnsModelWithPipeline() { var expectedPipelines = new List<DisplayablePipeline> { new DisplayablePipeline("Shared", "bob") }; var homeController = new HomeController(new FakeDashboard(expectedPipelines), new FakeXmlProfileLoader()); var result = (ViewResult)homeController.Refresh(""); var viewModel = (IndexViewModel)result.ViewData.Model; var pipeline = viewModel.Pipelines.First(); Assert.That(pipeline.Name, Is.EqualTo("Shared")); }