Example #1
0
        private IPersonalVehicleRepository BuildRepository(HttpResponseMessage httpResponseMessage, HttpMethod httpMethod, string absoluteUri)
        {
            var logger = ServiceProvider.GetService <ILogger <PersonalVehicleRepository> >();
            var httpClientFactoryMock = BuildHttpClientFactory(httpResponseMessage, httpMethod, "Fake", absoluteUri);

            TokenProviderMock.Setup(x => x.Token).Returns("loveDotNet");

            return(new PersonalVehicleRepository(Configuration, logger, httpClientFactoryMock.Object, TokenProviderMock.Object));
        }
Example #2
0
        public async Task ContactRepositoryFindAllAsync_ReturnData()
        {
            // Arrange
            var responseDto         = Fixture.Create <ContactResultModel>();
            var httpResponseMessage = new HttpResponseMessage
            {
                StatusCode = HttpStatusCode.OK,
                Content    = new StringContent(responseDto.ToJson())
            };

            Configuration.UseOAuth = true;
            TokenProviderMock.Setup(x => x.Token).Returns("loveDotNet");
            var repository = BuildRepository(httpResponseMessage, HttpMethod.Get, $"{Configuration.BaseUrl}/contacts/v1/lists/all/contacts/all");

            // Act
            var output = await repository.FindAllAsync();

            // Assert
            output.Should().NotBeNull();
        }