public async Task GetAll_Cats_Successful() { var cats = await CatService.GetAll(); cats.Count().Should().BeGreaterThan(0); ApiClientMock.VerifyGetAll <Cat>(); }
public async Task GetById_ForCatId_Successful() { var cat = TestData.Cats.FirstOrDefault(); var existingCat = await CatService.GetById(cat.Id); existingCat.Name.Should().Be(cat.Name); ApiClientMock.VerifyGetById <Cat>(); }
// ReSharper disable once InconsistentNaming public void Token_Returns_null_if_not_Authenticated() { var client = new ApiClientMock(); var parser = new ParserMock(); var auth = new AuthenticationClient(client, parser); Assert.Null(auth.Token); }
public void Init() { unitOfWork = new UnitOfWorkMock(); apiClient = new ApiClientMock(); cache = new CacheMock(); controller = new OrderApiController(unitOfWork, new MailHelper(new MimeMailerMock(), new RegistryReaderMock()), apiClient, new JwtDecoderMock(), cache); controller.Request = new HttpRequestMessage(); }
public async Task DeveListarAsMarcas() { //Arrage var pesquisa = new ApiClientMock().Buscar(); //Action var resultado = await pesquisa.ListarMarcas(); //Assert Assert.NotNull(resultado); }
// ReSharper disable once InconsistentNaming public void Token_Passes_The_Token_To_The_API_Client(string token) { var client = new ApiClientMock(); var parser = new ParserMock(); var auth = new AuthenticationClient(client, parser) { Token = token }; Assert.Equal($"Bearer {token}", client.DefaultRequestHeaders["Authorization"]); }
// ReSharper disable once InconsistentNaming public void Token_Gets_The_Token_From_The_API_Client(string token) { var client = new ApiClientMock(); client.HttpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); var parser = new ParserMock(); var auth = new AuthenticationClient(client, parser); Assert.Equal(token, auth.Token); }
public void Init() { unitOfWork = new UnitOfWorkMock(); mailHelper = new MailHelperMock(); pdfManager = new PdfManagerMock(); jwtDecoder = new JwtDecoderMock(); apiClient = new ApiClientMock(); request = new HttpRequestMessage(); webClient = new WebClientMock(); cache = new CacheMock(); controller = new InvoiceHistoryApiController(unitOfWork, mailHelper, apiClient, pdfManager, webClient, jwtDecoder, cache); controller.Request = new HttpRequestMessage(); }
// ReSharper disable once InconsistentNaming public void Token_Passes_The_Token_To_The_API_Client(string token) { var client = new ApiClientMock(); var parser = new ParserMock(); var auth = new AuthenticationClient(client, parser) { Token = token }; Assert.Equal(token, client.HttpClient.DefaultRequestHeaders.Authorization.Parameter); Assert.Equal("Bearer", client.HttpClient.DefaultRequestHeaders.Authorization.Scheme); }
// ReSharper disable once InconsistentNaming public void Token_Gets_The_Token_From_The_API_Client(string token) { var client = new ApiClientMock { DefaultRequestHeaders = { ["Authorization"] = $"Bearer {token}" } }; var parser = new ParserMock(); var auth = new AuthenticationClient(client, parser); Assert.Equal(token, auth.Token); }
public void OneTimeSetUp() { Setup.Bootstrap(SetupType.Test); ApiClientMock = new ApiClientMock(); CatServiceMock = new CatServiceMock(); MessageBrokerMock = new MessageBrokerMock <Cat>(); MessageConsumerMock = new MessageConsumerMock <Cat>(); MessageConsumerServiceMock = new MessageServiceMock <Cat>(); LoggerFactoryMock = new LoggerFactoryMock(); CatService = new CatService(MessageBrokerMock.Instance, ApiClientMock.Instance); MessageConsumer = new MessageConsumer <Cat>(ApiClientMock.Instance, LoggerFactoryMock.Instance); MessageService = new MessageService <Cat>(MessageBrokerMock.Instance, MessageConsumerMock.Instance, LoggerFactoryMock.Instance); ViewModel = new MainViewModel(CatServiceMock.Instance); }
public async Task Api_Client_Should_Give_Correct_Responses(string cityName) { // Arrange var client = new ApiClientMock(); // Act & Assert if (cityName.Equals(TestDataValues.CORRECT_CITY_NAME)) { var response = await client.GetOpenWeatherData(cityName); Assert.NotNull(response); } else { await Assert.ThrowsAnyAsync <Exception>(async() => await client.GetOpenWeatherData(cityName)); } }
public void Init() { unitOfWork = new UnitOfWorkMock(); apiClient = new ApiClientMock(); controller = new HolidayApiController(unitOfWork, new MailHelper(new MimeMailerMock(), new RegistryReaderMock()), apiClient, new JwtDecoderMock(), new CacheMock()); controller.Request = new HttpRequestMessage(); unitOfWork.Data = Utils.CreateAdminAndUser(); unitOfWork.Data.Holidays = new List <Holiday> { new Holiday { id = 1, date = DateTime.Today, name = "holiday1" }, new Holiday { id = 2, date = DateTime.Today.AddDays(2), name = "holiday2" }, new Holiday { id = 3, date = DateTime.Today.AddYears(-1), name = "holiday3" } }; }
public void Consume_DeleteMessage_Successful() { Consume_Message(MessageCommand.Delete); ApiClientMock.VerifyDelete(); }
public void Consume_UpdateMessage_Successful() { Consume_Message(MessageCommand.Update); ApiClientMock.VerifyUpdate(); }
public void Init() { apiClient = new ApiClientMock(); }