Ejemplo n.º 1
0
        public async Task TestOwnersAPI()
        {
            //Arrange
            var service = new CarOwnerService(configuration);

            //Act
            var result = await service.CallAPI();

            //Assert
            result.Should().NotBeNullOrEmpty();
            result.Should().BeOfType <string>();
        }
Ejemplo n.º 2
0
        public async Task JSONTesting()
        {
            //Arrange
            var service = new CarOwnerService(configuration);

            //Act
            var result = await service.CallAPI();

            // Deserialise the Json owner data from string and cast into an IEnumerable list of Owner.
            Action act = () => { JsonConvert.DeserializeObject <IEnumerable <Owner> >(result); };

            //Assert
            act.Should().NotThrow <Exception>();

            var owners = JsonConvert.DeserializeObject <IEnumerable <Owner> >(result);

            owners.Should().HaveCount(10);  // Should have 10 items from the original API
        }