Example #1
0
        public async Task GetPerson_ThrowsException()
        {
            PersonRepositoryMock.Setup(x => x.GetById(It.IsAny <int>()))
            .Throws(new InvalidOperationException());

            var result = await PersonServiceClient.GetPerson("1");
        }
Example #2
0
        public IActionResult Index()
        {
            logger.LogInformation("In index");

            PersonRepositoryMock rep = new PersonRepositoryMock();
            Person person            = rep.HentPerson();

            return(View(person));
        }
Example #3
0
        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);
        }
Example #4
0
        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);
        }
Example #6
0
 public void Setup()
 {
     this.personRepositoryMock = new PersonRepositoryMock();
     this.myApplication        = new MyApplication(this.personRepositoryMock);
 }