コード例 #1
0
 public AgenciesServiceTests()
 {
     _mapperMock      = new Mock <IMapper>();
     _agenciesService = new AgenciesService(
         _mapperMock.Object,
         DbContextProvider.GetSqlServerDbContext());
 }
コード例 #2
0
        public async Task AddAsync_Returns_None_If_Connection_To_Database_Is_Lost(Agency agency)
        {
            // Arrange
            var wrongConnectionString =
                "Server=x;Database=y;" +
                "Integrated Security=True;" +
                "Trusted_Connection=True;" +
                "MultipleActiveResultSets=true;";

            _agenciesService = new AgenciesService(
                _mapperMock.Object,
                DbContextProvider.GetSqlServerDbContext(wrongConnectionString));

            // Act
            var result = await _agenciesService.AddAsync(agency);

            // Assert
            result.HasValue.ShouldBe(false);
            result.MatchNone(error => error
                             .Messages
                             .ShouldAllBe(msg => msg == "An unhandled exception has occurred while creating the agency : " +
                                          "A network-related or instance-specific error occurred while " +
                                          "establishing a connection to SQL Server. " +
                                          "The server was not found or was not accessible. " +
                                          "Verify that the instance name is correct and that SQL Server " +
                                          "is configured to allow remote connections. " +
                                          "(provider: Named Pipes Provider, error: 40 - " +
                                          "Could not open a connection to SQL Server)!"));
        }
コード例 #3
0
ファイル: MaidsController.cs プロジェクト: koland/bshkara
 public MaidsController(IUnitOfWork unitOfWork, MaidsService service,
                        MaidEmploymentHistoriesService maidEmploymentHistoriesService, MaidLanguagesService maidLanguagesService,
                        MaidSkillsService maidSkillsService, MaidDocumentsService maidDocumentsService,
                        AgenciesService agenciesService, CitiesService citiesService, NationalitiesService nationalitiesService,
                        VisaStatusService visaStatusService, AgencyPacksService agencyPacksService)
     : base(unitOfWork, service)
 {
     _maidEmploymentHistoriesService = maidEmploymentHistoriesService;
     _maidLanguagesService           = maidLanguagesService;
     _maidSkillsService    = maidSkillsService;
     _maidDocumentsService = maidDocumentsService;
     _agenciesService      = agenciesService;
     _citiesService        = citiesService;
     _nationalitiesService = nationalitiesService;
     _visaStatusService    = visaStatusService;
     _agencyPacksService   = agencyPacksService;
 }