public void TestGetAllScenarios() { #region Test Setup _xmlDataProvider.Setup(x => x.GetAllScenarios()).Returns(new List <Scenario>() { new Scenario() { Name = "sathesh", Surname = "Mani", ScenarioID = 1 }, new Scenario() { Name = "sathesh", Surname = "Mani", ScenarioID = 2 }, new Scenario() { Name = "someone", Surname = "Mani", ScenarioID = 2 } }); #endregion ScenarioRepository scenarioRepository = new ScenarioRepository(_xmlDataProvider.Object); var scenarios = scenarioRepository.GetAllScenarios(); Assert.NotNull(scenarios); Assert.NotNull(scenarios.Count == 3); var userSathesh = scenarios.Where(x => x.Name == "sathesh").ToList(); Assert.NotNull(userSathesh.Count == 2); }
public JsonResult GetAllScenarios() { var data = _scenariosRepository.GetAllScenarios(); return(new JsonResult() { Data = data, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public void GetAllScenariosTest() { //Arrange _iScenarioDataProvider = new Mock <IScenarioDataProvider>(); _iScenarioDataProvider.Setup(x => x.GetAllScenarios()).Returns(new List <Scenarios.Models.Scenario>() { new Scenarios.Models.Scenario() { UserID = Guid.NewGuid().ToString() } }); //Act ScenarioRepository scenarioRepository = new ScenarioRepository(_iScenarioDataProvider.Object); var lst = scenarioRepository.GetAllScenarios(); //Assert Assert.NotNull(lst); Assert.AreEqual(lst.Count, 1); }