public async Task AddTaxiCompanyAsync_AddingTaxiCompanySucceeds_ReturnsARegisterResponseTaxiCompanyThatContainsTheExpectedTaxiCompanyDto() { var request = new RegisterRequest { Email = "*****@*****.**", Name = "Name", Password = "******", PasswordRepeated = "Qwer111!", PhoneNumber = "12345678" }; var taxiCompany = new TaxiCompany { Email = request.Email, Name = request.Name, PhoneNumber = request.PhoneNumber }; _unitofWork.TaxiCompanyRepository.Add(null).ReturnsForAnyArgs(taxiCompany); var taxiCompanyDto = new TaxiCompanyDto { Email = request.Email, Name = request.Name, PhoneNumber = request.PhoneNumber }; _mapper.Map <TaxiCompanyDto>(null).ReturnsForAnyArgs(taxiCompanyDto); var response = await _taxiCompanyService.AddTaxiCompanyAsync(request); Assert.That(response.TaxiCompany, Is.EqualTo(taxiCompanyDto)); }
public async Task LoginTaxiCompanyAsync_LoginSucceeds_ReturnsLoginResponseThatContainsTheExpectedTaxiCompanyDto() { // Arrange var request = new LoginRequest { Email = "*****@*****.**", Password = "******" }; var token = "Token"; _unitofWork.IdentityUserRepository.SignInAsync(null, null).ReturnsForAnyArgs(SignInResult.Success); _jwtService.GenerateJwtToken(null, null, null).ReturnsForAnyArgs(token); var taxiCompany = new TaxiCompany { Id = "Some Id", Email = request.Email }; _unitofWork.TaxiCompanyRepository.FindByEmail(null).ReturnsForAnyArgs(taxiCompany); var taxiCompanyDto = new TaxiCompanyDto { Email = request.Email, Name = "Some Name", PhoneNumber = "12345678" }; _mapper.Map <TaxiCompanyDto>(null).ReturnsForAnyArgs(taxiCompanyDto); // Act var response = await _taxiCompanyService.LoginTaxiCompanyAsync(request); // Assert Assert.That(response.TaxiCompany, Is.EqualTo(taxiCompanyDto)); }