public async Task GetPerson_ThrowsException() { PersonRepositoryMock.Setup(x => x.GetById(It.IsAny <int>())) .Throws(new InvalidOperationException()); var result = await PersonServiceClient.GetPerson("1"); }
public IActionResult Index() { logger.LogInformation("In index"); PersonRepositoryMock rep = new PersonRepositoryMock(); Person person = rep.HentPerson(); return(View(person)); }
public async Task GetPerson_ReturnsCorrectResult() { PersonRepositoryMock.Setup(x => x.GetById(It.IsAny <int>())) .Returns(_person); var response = await PersonServiceClient.GetPerson("1"); Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); Assert.AreEqual("Mocked LN1", response.Result.LastName); }
public async Task GetPersons() { PersonRepositoryMock.Setup(x => x.GetAll()) .Returns(new List <Person> { _person }); var response = await PersonServiceClient.GetPersons(); Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); Assert.AreEqual(1, response.Result.Count); Assert.AreEqual("Mocked LN1", response.Result[0].LastName); }
public async Task GetRounds() { string gamekey = "3453532"; PersonRepositoryMock.Setup(x => x.GetAll(1)) .Returns(new List <Round> { _round }); var response = await PersonServiceClient.GetPersons(); Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); Assert.AreEqual(1, response.Result.Count); Assert.AreEqual("Mocked FN1", response.Result[0].Name); }
public void Setup() { this.personRepositoryMock = new PersonRepositoryMock(); this.myApplication = new MyApplication(this.personRepositoryMock); }