Beispiel #1
0
        public async Task GetPersonInfoAsync_MockWebApi_PersonId_Person()
        {
            // Arrange
            const int personId = 1;
            var       json     = File.ReadAllText(Path.Combine(BasePath, DomainObjectFactoryTests.JSON_DATA_PATH, "person.json"));
            var       mockHttp = new MockHttpMessageHandler();

            mockHttp.Expect($"{BASE_API_URL}/people/{personId}")
            .Respond("application/json", json);

            var tvMazeClient = new TvMazeClient(BASE_API_URL, mockHttp.ToHttpClient());

            // Act
            var person = await tvMazeClient.GetPersonInfoAsync(personId);

            // Assert
            Assert.IsNotNull(person);
            Assert.AreEqual(personId, person.Id);
            mockHttp.VerifyNoOutstandingExpectation();
        }