示例#1
0
        public void SetUp()
        {
            var idCounter = 0;

            repoList         = new List <DriveReport>();
            _emplMock        = Substitute.For <IGenericRepository <Employment> >();
            _calculatorMock  = Substitute.For <IReimbursementCalculator>();
            _orgUnitMock     = Substitute.For <IGenericRepository <OrgUnit> >();
            _rateTypeMock    = Substitute.For <IGenericRepository <RateType> >();
            _routeMock       = Substitute.For <IRoute <RouteInformation> >();
            _coordinatesMock = Substitute.For <IAddressCoordinates>();
            _subMock         = Substitute.For <IGenericRepository <Core.DomainModel.Substitute> >();
            _mailMock        = Substitute.For <IMailSender>();
            _reportRepoMock  = NSubstitute.Substitute.For <IGenericRepository <DriveReport> >();
            _personMock      = Substitute.For <IGenericRepository <Person> >();
            _logger          = new Core.ApplicationServices.Logger.Logger();

            _reportRepoMock.Insert(new DriveReport()).ReturnsForAnyArgs(x => x.Arg <DriveReport>()).AndDoes(x => repoList.Add(x.Arg <DriveReport>())).AndDoes(x => x.Arg <DriveReport>().Id = idCounter).AndDoes(x => idCounter++);
            _reportRepoMock.AsQueryable().ReturnsForAnyArgs(repoList.AsQueryable());

            _calculatorMock.Calculate(new RouteInformation(), new DriveReport()).ReturnsForAnyArgs(x => x.Arg <DriveReport>());

            _rateTypeMock.AsQueryable().ReturnsForAnyArgs(new List <RateType>
            {
                new RateType()
                {
                    TFCode = "1234",
                    IsBike = false,
                    RequiresLicensePlate = true,
                    Id          = 1,
                    Description = "TestRate"
                }
            }.AsQueryable());

            _coordinatesMock.GetAddressCoordinates(new Address()).ReturnsForAnyArgs(new DriveReportPoint()
            {
                Latitude  = "1",
                Longitude = "2",
            });

            _routeMock.GetRoute(DriveReportTransportType.Car, new List <Address>()).ReturnsForAnyArgs(new RouteInformation()
            {
                Length = 2000
            });

            _uut = new DriveReportService(_mailMock, _reportRepoMock, _calculatorMock, _orgUnitMock, _emplMock, _subMock, _coordinatesMock, _routeMock, _rateTypeMock, _personMock, _logger);
        }
示例#2
0
        public APIService(IServiceProvider provider)
        {
            _orgUnitRepo           = provider.GetService <IGenericRepository <OrgUnit> >();
            _cachedRepo            = provider.GetService <IGenericRepository <CachedAddress> >();
            _actualLaunderer       = provider.GetService <IAddressLaunderer>();
            _coordinates           = provider.GetService <IAddressCoordinates>();;
            _personRepo            = provider.GetService <IGenericRepository <Person> >();;
            _subService            = provider.GetService <ISubstituteService>();;
            _subRepo               = provider.GetService <IGenericRepository <Substitute> >();;
            _reportRepo            = provider.GetService <IGenericRepository <DriveReport> >();;
            _driveService          = provider.GetService <IDriveReportService>();;
            _logger                = provider.GetService <ILogger <APIService> >();;
            _launderer             = new CachedAddressLaunderer(_cachedRepo, _actualLaunderer, _coordinates);
            _addressHistoryService = provider.GetService <AddressHistoryService>();
            _configuration         = provider.GetService <IConfiguration>();

            // manually handle changes on these large datasets to improve performance
            _orgUnitRepo.SetChangeTrackingEnabled(false);
            _personRepo.SetChangeTrackingEnabled(false);
            _subRepo.SetChangeTrackingEnabled(false);
            _reportRepo.SetChangeTrackingEnabled(false);
        }
        public void SetUp()
        {
            var orgList = new List <OrgUnit>();

            var orgIdCount = 0;

            var cachedAddressList = new List <CachedAddress>();
            var cachedIdCount     = 0;

            _emplRepoMock            = NSubstitute.Substitute.For <IGenericRepository <Employment> >();
            _orgUnitRepoMock         = NSubstitute.Substitute.For <IGenericRepository <OrgUnit> >();
            _personRepoMock          = NSubstitute.Substitute.For <IGenericRepository <Person> >();
            _cachedAddressRepoMock   = NSubstitute.Substitute.For <IGenericRepository <CachedAddress> >();
            _personalAddressRepoMock = NSubstitute.Substitute.For <IGenericRepository <PersonalAddress> >();
            _actualLaunderer         = NSubstitute.Substitute.For <IAddressLaunderer>();
            _coordinates             = NSubstitute.Substitute.For <IAddressCoordinates>();
            _dataProvider            = NSubstitute.Substitute.For <IDbUpdaterDataProvider>();
            _mailSender = NSubstitute.Substitute.For <IMailSender>();

            _orgUnitRepoMock.AsQueryable().Returns(orgList.AsQueryable());

            _orgUnitRepoMock.Insert(new OrgUnit()).ReturnsForAnyArgs(x => x.Arg <OrgUnit>()).AndDoes(x => orgList.Add(x.Arg <OrgUnit>())).AndDoes(x => x.Arg <OrgUnit>().Id = orgIdCount).AndDoes(x => orgIdCount++);

            _cachedAddressRepoMock.Insert(new CachedAddress()).ReturnsForAnyArgs(x => x.Arg <CachedAddress>()).AndDoes(x => cachedAddressList.Add(x.Arg <CachedAddress>())).AndDoes(x => x.Arg <CachedAddress>().Id = cachedIdCount).AndDoes(x => cachedIdCount++);

            _cachedAddressRepoMock.AsQueryable().Returns(cachedAddressList.AsQueryable());

            _subRepo      = NSubstitute.Substitute.For <IGenericRepository <Core.DomainModel.Substitute> >();
            _reportRepo   = NSubstitute.Substitute.For <IGenericRepository <DriveReport> >();
            _driveService = NSubstitute.Substitute.For <IDriveReportService>();
            _subservice   = NSubstitute.Substitute.For <ISubstituteService>();

            _actualLaunderer.Launder(new Address()).ReturnsForAnyArgs(x => x.Arg <CachedAddress>());

            _uut = new UpdateService(_emplRepoMock, _orgUnitRepoMock, _personRepoMock, _cachedAddressRepoMock,
                                     _personalAddressRepoMock, _actualLaunderer, _coordinates, _dataProvider, _mailSender, NSubstitute.Substitute.For <IAddressHistoryService>(), _reportRepo, _driveService, _subservice, _subRepo);
        }
 public DriveReportSyncService(IGenericRepository <Core.DmzModel.DriveReport> dmzDriveReportRepo, IGenericRepository <Core.DomainModel.DriveReport> masterDriveReportRepo, IGenericRepository <Core.DomainModel.Rate> rateRepo, IGenericRepository <LicensePlate> licensePlateRepo, IDriveReportService driveService, IRoute <RouteInformation> routeService, IAddressCoordinates coordinates, IGenericRepository <Core.DomainModel.Employment> emplRepo, ILogger logger)
 {
     _dmzDriveReportRepo    = dmzDriveReportRepo;
     _masterDriveReportRepo = masterDriveReportRepo;
     _rateRepo         = rateRepo;
     _licensePlateRepo = licensePlateRepo;
     _driveService     = driveService;
     _routeService     = routeService;
     _coordinates      = coordinates;
     _emplRepo         = emplRepo;
     _logger           = logger;
 }
        public void SetUp()
        {
            var personList = new List <Person>();
            var emplList   = new List <Employment>();

            var emplIdCount   = 0;
            var personIdCount = 0;

            var cachedAddressList   = new List <CachedAddress>();
            var cachedIdCount       = 0;
            var personalAddressList = new List <PersonalAddress>();
            var personalIdCount     = 0;

            _emplRepoMock            = NSubstitute.Substitute.For <IGenericRepository <Employment> >();
            _orgUnitRepoMock         = NSubstitute.Substitute.For <IGenericRepository <OrgUnit> >();
            _personRepoMock          = NSubstitute.Substitute.For <IGenericRepository <Person> >();
            _cachedAddressRepoMock   = NSubstitute.Substitute.For <IGenericRepository <CachedAddress> >();
            _personalAddressRepoMock = NSubstitute.Substitute.For <IGenericRepository <PersonalAddress> >();
            _actualLaundererMock     = NSubstitute.Substitute.For <IAddressLaunderer>();
            _coordinatesMock         = NSubstitute.Substitute.For <IAddressCoordinates>();
            _dataProviderMock        = NSubstitute.Substitute.For <IDbUpdaterDataProvider>();
            _workAddressRepoMock     = NSubstitute.Substitute.For <IGenericRepository <WorkAddress> >();
            _mailServiceMock         = NSubstitute.Substitute.For <IMailService>();
            _actualLaunderer         = NSubstitute.Substitute.For <IAddressLaunderer>();
            _coordinates             = NSubstitute.Substitute.For <IAddressCoordinates>();
            _dataProvider            = NSubstitute.Substitute.For <IDbUpdaterDataProvider>();


            _subRepo      = NSubstitute.Substitute.For <IGenericRepository <Core.DomainModel.Substitute> >();
            _reportRepo   = NSubstitute.Substitute.For <IGenericRepository <DriveReport> >();
            _driveService = NSubstitute.Substitute.For <IDriveReportService>();
            _subservice   = NSubstitute.Substitute.For <ISubstituteService>();

            _personRepoMock.AsQueryable().Returns(personList.AsQueryable());

            _personRepoMock.Insert(new Person()).ReturnsForAnyArgs(x => x.Arg <Person>()).AndDoes(x => personList.Add(x.Arg <Person>())).AndDoes(x => x.Arg <Person>().Id = personIdCount).AndDoes(x => personIdCount++);

            _emplRepoMock.AsQueryable().Returns(emplList.AsQueryable());

            _emplRepoMock.Insert(new Employment()).ReturnsForAnyArgs(x => x.Arg <Employment>()).AndDoes(x => emplList.Add(x.Arg <Employment>())).AndDoes(x => x.Arg <Employment>().Id = emplIdCount).AndDoes(x => emplIdCount++);

            _cachedAddressRepoMock.Insert(new CachedAddress()).ReturnsForAnyArgs(x => x.Arg <CachedAddress>()).AndDoes(x => cachedAddressList.Add(x.Arg <CachedAddress>())).AndDoes(x => x.Arg <CachedAddress>().Id = cachedIdCount).AndDoes(x => cachedIdCount++);

            cachedAddressList.Add(new CachedAddress()
            {
                Id           = 999,
                StreetName   = "Katrinebjergvej",
                StreetNumber = "93B",
                ZipCode      = 8200,
                Town         = "Aarhus N",
                DirtyString  = "Katrinebjergvej 93B, 8200 Aarhus N",
            });

            _cachedAddressRepoMock.AsQueryable().Returns(cachedAddressList.AsQueryable());

            _personalAddressRepoMock.Insert(new PersonalAddress()).ReturnsForAnyArgs(x => x.Arg <PersonalAddress>()).AndDoes(x => personalAddressList.Add(x.Arg <PersonalAddress>())).AndDoes(x => x.Arg <PersonalAddress>().Id = personalIdCount).AndDoes(x => personalIdCount++);

            _personalAddressRepoMock.AsQueryable().Returns(personalAddressList.AsQueryable());

            _actualLaundererMock.Launder(new Address()).ReturnsForAnyArgs(x => x.Arg <CachedAddress>());

            _uut = new UpdateService(_emplRepoMock, _orgUnitRepoMock, _personRepoMock, _cachedAddressRepoMock,
                                     _personalAddressRepoMock, _actualLaunderer, _coordinates, _dataProvider, _mailServiceMock, NSubstitute.Substitute.For <IAddressHistoryService>(), _reportRepo, _driveService, _subservice, _subRepo);

            _orgUnitRepoMock.AsQueryable().ReturnsForAnyArgs(new List <OrgUnit>()
            {
                new OrgUnit()
                {
                    Id                    = 1,
                    OrgId                 = 1,
                    ShortDescription      = "ITM",
                    LongDescription       = "IT Minds, Aarhus",
                    Level                 = 0,
                    HasAccessToFourKmRule = false,
                },
                new OrgUnit()
                {
                    Id                    = 2,
                    OrgId                 = 2,
                    ShortDescription      = "ITMB",
                    LongDescription       = "IT Minds, Aarhus child",
                    Level                 = 1,
                    ParentId              = 1,
                    HasAccessToFourKmRule = false,
                }
            }.AsQueryable());

            personList.Add(new Person()
            {
                Id = 1,
            });
        }
示例#6
0
        public void SetUp()
        {
            _emplRepo               = NSubstitute.Substitute.For <IGenericRepository <Employment> >();
            _logger                 = NSubstitute.Substitute.For <ILogger>();
            _dmzRepoMock            = NSubstitute.Substitute.For <IGenericRepository <Core.DmzModel.DriveReport> >();
            _coordinatesMock        = NSubstitute.Substitute.For <IAddressCoordinates>();
            _masterRepoMock         = NSubstitute.Substitute.For <IGenericRepository <Core.DomainModel.DriveReport> >();
            _driveReportServiceMock = NSubstitute.Substitute.For <IDriveReportService>();
            _rateRepoMock           = NSubstitute.Substitute.For <IGenericRepository <Rate> >();
            _licensePlateRepoMock   = NSubstitute.Substitute.For <IGenericRepository <LicensePlate> >();
            _routeMock              = NSubstitute.Substitute.For <IRoute <RouteInformation> >();
            _routeMock.GetRoute(DriveReportTransportType.Car, new List <Address>()).ReturnsForAnyArgs(new RouteInformation()
            {
                GeoPoints = "geogeo"
            });

            _coordinatesMock.GetAddressFromCoordinates(new Address()).ReturnsForAnyArgs(new Address()
            {
                Latitude     = "1",
                Longitude    = "1",
                StreetName   = "Katrinebjergvej",
                StreetNumber = "93B",
                ZipCode      = 8200,
                Town         = "Aarhus N"
            });

            _dmzRepoMock.WhenForAnyArgs(x => x.Delete(new Core.DmzModel.DriveReport())).Do(p => _dmzReportList.Remove(p.Arg <Core.DmzModel.DriveReport>()));


            _driveReportServiceMock.WhenForAnyArgs(x => x.Create(new Core.DomainModel.DriveReport())).Do(rep => _masterReportList.Add(rep.Arg <Core.DomainModel.DriveReport>()));
            _dmzRepoMock.WhenForAnyArgs(x => x.Insert(new Core.DmzModel.DriveReport())).Do(t => _dmzReportList.Add(t.Arg <Core.DmzModel.DriveReport>()));

            _rateRepoMock.AsQueryable().ReturnsForAnyArgs(new List <Rate>()
            {
                new Rate()
                {
                    Id     = 1,
                    KmRate = 12,
                    Active = true,
                    Year   = 2015,
                    Type   = new RateType()
                    {
                        Id = 1,
                        RequiresLicensePlate = true,
                        TFCode      = "1234",
                        Description = "TestDescription"
                    }
                }
            }.AsQueryable());

            _licensePlateRepoMock.AsQueryable().ReturnsForAnyArgs(new List <LicensePlate>()
            {
                new LicensePlate()
                {
                    Id          = 1,
                    PersonId    = 1,
                    Plate       = "TestPlate",
                    IsPrimary   = true,
                    Description = "TestDesc",
                }
            }.AsQueryable());

            _dmzReportList = new List <DriveReport>()
            {
                new DriveReport()
                {
                    Id                = 1,
                    Purpose           = "Test",
                    StartsAtHome      = false,
                    EndsAtHome        = false,
                    ManualEntryRemark = "ManualEntry",
                    Date              = "2015-05-27",
                    EmploymentId      = 1,
                    ProfileId         = 1,
                    RateId            = 1,
                    Profile           = new Profile()
                    {
                        FullName = "Test Testesen [TT]"
                    },
                    Route = new Route()
                    {
                        Id             = 1,
                        GPSCoordinates = new List <GPSCoordinate>()
                        {
                            new GPSCoordinate()
                            {
                                Latitude  = StringCipher.Encrypt("1", Encryptor.EncryptKey),
                                Longitude = StringCipher.Encrypt("1", Encryptor.EncryptKey),
                            },
                            new GPSCoordinate()
                            {
                                Latitude  = StringCipher.Encrypt("2", Encryptor.EncryptKey),
                                Longitude = StringCipher.Encrypt("2", Encryptor.EncryptKey),
                            }
                        }
                    }
                },
                new DriveReport()
                {
                    Id                = 2,
                    Purpose           = "Test2",
                    StartsAtHome      = true,
                    EndsAtHome        = true,
                    ManualEntryRemark = "ManualEntry",
                    Date              = "2015-05-26",
                    EmploymentId      = 1,
                    ProfileId         = 1,
                    RateId            = 1,
                    Profile           = new Profile()
                    {
                        FullName = "Test Testesen [TT]"
                    },
                    Route = new Route()
                    {
                        Id             = 2,
                        GPSCoordinates = new List <GPSCoordinate>()
                        {
                            new GPSCoordinate()
                            {
                                Latitude  = StringCipher.Encrypt("1", Encryptor.EncryptKey),
                                Longitude = StringCipher.Encrypt("1", Encryptor.EncryptKey),
                            },
                            new GPSCoordinate()
                            {
                                Latitude  = StringCipher.Encrypt("2", Encryptor.EncryptKey),
                                Longitude = StringCipher.Encrypt("2", Encryptor.EncryptKey),
                            }
                        }
                    }
                }
            };

            _masterRepoMock.AsQueryable().ReturnsForAnyArgs(_masterReportList.AsQueryable());
            _dmzRepoMock.AsQueryable().ReturnsForAnyArgs(_dmzReportList.AsQueryable());

            _uut = new DriveReportSyncService(_dmzRepoMock, _masterRepoMock, _rateRepoMock, _licensePlateRepoMock, _driveReportServiceMock, _routeMock, _coordinatesMock, _emplRepo, _logger);
        }
 public MailService(IGenericRepository <DriveReport> driveRepo, IGenericRepository <Substitute> subRepo, IMailSender mailSender, IDriveReportService driveReportService, ILogger logger)
 {
     _driveRepo          = driveRepo;
     _subRepo            = subRepo;
     _mailSender         = mailSender;
     _driveReportService = driveReportService;
     _logger             = logger;
 }
示例#8
0
 public DriveReportsController(IGenericRepository <BankAccount> Bankrepo, IGenericRepository <OrgUnit> orgrepo, IGenericRepository <DriveReport> repo, IDriveReportService driveService, IGenericRepository <Person> personRepo, IGenericRepository <Employment> employmentRepo, IGenericRepository <LicensePlate> licensePlateRepo, ILogger logger)
     : base(repo, personRepo)
 {
     _driveService     = driveService;
     _employmentRepo   = employmentRepo;
     _logger           = logger;
     _personRepo       = personRepo;
     _orgrepo          = orgrepo;
     _Bankrepo         = Bankrepo;
     _LicensePlateRepo = licensePlateRepo;
 }
示例#9
0
 public SubstituteService(IGenericRepository <Substitute> subRepo, IOrgUnitService orgService, IDriveReportService driveService, IGenericRepository <DriveReport> driveRepo)
 {
     _subRepo      = subRepo;
     _orgService   = orgService;
     _driveService = driveService;
     _driveRepo    = driveRepo;
 }
        public void SetUp()
        {
            _orgService   = NSubstitute.Substitute.For <IOrgUnitService>();
            _repoMock     = NSubstitute.Substitute.For <IGenericRepository <Substitute> >();
            _driveRepo    = NSubstitute.Substitute.For <IGenericRepository <DriveReport> >();
            _emplMock     = NSubstitute.Substitute.For <IGenericRepository <Employment> >();
            _orgUnitMock  = NSubstitute.Substitute.For <IGenericRepository <OrgUnit> >();
            _driveService = NSubstitute.Substitute.For <IDriveReportService>();

            _repo = new List <Substitute>
            {
                new Substitute()
                {
                    Sub = new Person()
                    {
                        CprNumber = "123123",
                        FirstName = "Jacob",
                        LastName  = "Jensen",
                        Initials  = "JOJ"
                    },
                    Leader = new Person()
                    {
                        CprNumber = "123123",
                        FirstName = "Morten",
                        LastName  = "Rasmussen",
                        Initials  = "MR"
                    },
                    Person = new Person()
                    {
                        CprNumber = "123123",
                        FirstName = "Morten",
                        LastName  = "Rasmussen",
                        Initials  = "MR"
                    },
                },
                new Substitute()
                {
                    Sub = new Person()
                    {
                        CprNumber = "123123",
                        FirstName = "Jacob",
                        LastName  = "Jensen",
                        Initials  = "JOJ"
                    },
                    Leader = new Person()
                    {
                        CprNumber = "123123",
                        FirstName = "Morten",
                        LastName  = "Rasmussen",
                        Initials  = "MR"
                    },
                    Person = new Person()
                    {
                        CprNumber = "123123",
                        FirstName = "Jacob",
                        LastName  = "Jensen",
                        Initials  = "JOJ"
                    },
                }
            };

            var leader1 = new Person()
            {
                Id        = 1,
                FirstName = "Test",
                LastName  = "Testesen",
                Initials  = "TT",
                FullName  = "Test Testesen [TT]"
            };

            var leader2 = new Person()
            {
                Id        = 3,
                FirstName = "Test2",
                LastName  = "Testesen2",
                Initials  = "2",
                FullName  = "Test Testesen [2]"
            };

            var user1 = new Person()
            {
                Id        = 2,
                FirstName = "User",
                LastName  = "Usersen",
                Initials  = "UU",
                FullName  = "User Usersen [UU]"
            };

            var user2 = new Person()
            {
                Id        = 4,
                FirstName = "User",
                LastName  = "Usersen",
                Initials  = "UU",
                FullName  = "User Usersen [UU]"
            };

            var orgUnit = new OrgUnit()
            {
                Id = 1,
            };

            var orgUnit2 = new OrgUnit()
            {
                Id = 12,
            };

            var leaderEmpl1 = new Employment()
            {
                Id        = 1,
                OrgUnitId = 1,
                OrgUnit   = orgUnit,
                Person    = leader1,
                PersonId  = leader1.Id,
                IsLeader  = true
            };

            var leaderEmpl2 = new Employment()
            {
                Id        = 2,
                OrgUnitId = 2,
                OrgUnit   = orgUnit2,
                Person    = leader1,
                PersonId  = leader1.Id,
                IsLeader  = true
            };

            var userEmpl1 = new Employment()
            {
                Id        = 3,
                OrgUnitId = 1,
                OrgUnit   = orgUnit,
                Person    = user1,
                PersonId  = user1.Id,
                IsLeader  = false
            };

            var userEmpl2 = new Employment()
            {
                Id        = 4,
                OrgUnitId = 2,
                OrgUnit   = orgUnit2,
                Person    = user2,
                PersonId  = user2.Id,
                IsLeader  = false
            };

            _emplMock.AsQueryable().ReturnsForAnyArgs(new List <Employment>()
            {
                leaderEmpl1,
                userEmpl1,
                leaderEmpl2,
                userEmpl2
            }.AsQueryable());

            _orgUnitMock.AsQueryable().ReturnsForAnyArgs(new List <OrgUnit>()
            {
                orgUnit,
                orgUnit2
            }.AsQueryable());

            var reports = new List <DriveReport>()
            {
                new DriveReport()
                {
                    Id           = 1,
                    Employment   = userEmpl1,
                    EmploymentId = userEmpl1.Id,
                    PersonId     = user1.Id,
                    Person       = user1,
                },
                new DriveReport()
                {
                    Id           = 2,
                    Employment   = userEmpl1,
                    EmploymentId = userEmpl1.Id,
                    PersonId     = user1.Id,
                    Person       = user1,
                },
                new DriveReport()
                {
                    Id           = 3,
                    Employment   = userEmpl2,
                    EmploymentId = userEmpl2.Id,
                    PersonId     = user2.Id,
                    Person       = user2,
                },
                new DriveReport()
                {
                    Id           = 4,
                    Employment   = userEmpl2,
                    EmploymentId = userEmpl2.Id,
                    PersonId     = user2.Id,
                    Person       = user2,
                },
                new DriveReport()
                {
                    Id           = 5,
                    Employment   = leaderEmpl1,
                    EmploymentId = leaderEmpl1.Id,
                    PersonId     = 1
                },
                new DriveReport()
                {
                    Id           = 6,
                    Employment   = leaderEmpl2,
                    EmploymentId = leaderEmpl2.Id,
                    PersonId     = 3
                }
            };

            _driveRepo.AsQueryable().ReturnsForAnyArgs(reports.AsQueryable());

            _uut = new SubstituteService(_repoMock, _orgService, _driveService, _driveRepo, _logger);
        }
 //GET: odata/Substitutes
 public SubstitutesController(IGenericRepository <Substitute> repository, ISubstituteService sub, IGenericRepository <Person> personRepo, IGenericRepository <DriveReport> driveRepo, IOrgUnitService orgService, IDriveReportService driveService)
     : base(repository, personRepo)
 {
     _sub          = sub;
     _driveRepo    = driveRepo;
     _orgService   = orgService;
     _driveService = driveService;
 }
示例#12
0
        public void SetUp()
        {
            _orgService   = NSubstitute.Substitute.For <IOrgUnitService>();
            _repoMock     = NSubstitute.Substitute.For <IGenericRepository <Substitute> >();
            _driveRepo    = NSubstitute.Substitute.For <IGenericRepository <DriveReport> >();
            _driveService = NSubstitute.Substitute.For <IDriveReportService>();


            _repo = new List <Substitute>
            {
                new Substitute()
                {
                    Sub = new Person()
                    {
                        CprNumber = "123123",
                        FirstName = "Jacob",
                        LastName  = "Jensen",
                        Initials  = "JOJ"
                    },
                    Leader = new Person()
                    {
                        CprNumber = "123123",
                        FirstName = "Morten",
                        LastName  = "Rasmussen",
                        Initials  = "MR"
                    },
                    Person =
                        new Person()
                    {
                        CprNumber = "123123",
                        FirstName = "Morten",
                        LastName  = "Rasmussen",
                        Initials  = "MR"
                    },
                },
                new Substitute()
                {
                    Sub = new Person()
                    {
                        CprNumber = "123123",
                        FirstName = "Jacob",
                        LastName  = "Jensen",
                        Initials  = "JOJ"
                    },
                    Leader = new Person()
                    {
                        CprNumber = "123123",
                        FirstName = "Morten",
                        LastName  = "Rasmussen",
                        Initials  = "MR"
                    },
                    Person = new Person()
                    {
                        CprNumber = "123123",
                        FirstName = "Jacob",
                        LastName  = "Jensen",
                        Initials  = "JOJ"
                    },
                }
            };

            _uut = new SubstituteService(_repoMock, _orgService, _driveService, _driveRepo);
        }
 public AlternativeCalculationController(IDriveReportService driveReportService)
 {
     _driveReportService = driveReportService;
 }