public void RaceControllerGetRaces_NameEmpty_ThrowError() { var _raceHelperTest = new Mock <IRaceHelper>().Object; var _logHelperTest = new Mock <ILogger>().Object; RaceController raceController = new RaceController(_raceHelperTest, _logHelperTest); StandardResponse response = raceController.GetRaces(); var resultResponse = (ErrorRespose)response.Response; Assert.AreEqual(resultResponse.ErrorReason, "Name is Empty"); }
public void RaceControllerGetRaces() { var _raceDBTest = new Mock <IRaceDBConnector>(); var _logHelperTest = new Mock <ILogger>().Object; AutoMapperConfig.Initialize(); _raceDBTest.Setup(race => race.GetRaces()).Returns(new List <SP_GetRaceDetails_Result>()); var _raceHelperTest = new RaceHelper(_raceDBTest.Object, _logHelperTest); RaceController raceController = new RaceController(_raceHelperTest, _logHelperTest); StandardResponse response = raceController.GetRaces("Ashwini"); var helperResponse = (List <Race>)response.Response; Assert.AreEqual(helperResponse.Count, 0); }
public void RaceControllerGetRaces_GetRaces_ReturnRaces() { var _raceHelperTest = new Mock <IRaceHelper>(); var _logHelperTest = new Mock <ILogger>(); StandardResponse response = new StandardResponse(); var raceList = new List <Race>(); raceList.Add(new Race { Id = 1, Name = "Melbourne Cup", Stake = 100, Status = "Pending" }); response.Response = raceList; _raceHelperTest.Setup(race => race.GetRaces()).Returns(response); RaceController raceController = new RaceController(_raceHelperTest.Object, _logHelperTest.Object); StandardResponse helperResponse = raceController.GetRaces("ashwini"); var resultRace = (List <Race>)helperResponse.Response; Assert.AreEqual(resultRace.Count, 1); }