public void SetUp() { _dmzRateList = new List <Rate>(); _masterRateList = new List <Core.DomainModel.Rate>(); _dmzRepoMock = NSubstitute.Substitute.For <IGenericDmzRepository <Core.DmzModel.Rate> >(); _masterRepoMock = NSubstitute.Substitute.For <IGenericRepository <Core.DomainModel.Rate> >(); _dmzRepoMock.WhenForAnyArgs(x => x.Insert(new Core.DmzModel.Rate())).Do(p => _dmzRateList.Add(p.Arg <Core.DmzModel.Rate>())); _dmzRepoMock.AsQueryable().Returns(_dmzRateList.AsQueryable()); _uut = new RateSyncService(_dmzRepoMock, _masterRepoMock); }
public DriveReportSyncService(IGenericDmzRepository <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() { _dmzRepoMock = NSubstitute.Substitute.For <IGenericDmzRepository <Profile> >(); _masterRepoMock = NSubstitute.Substitute.For <IGenericRepository <Person> >(); _personServiceMock = NSubstitute.Substitute.For <IPersonService>(); _dmzRepoMock.WhenForAnyArgs(x => x.Delete(new Profile())).Do(p => _dmzProfileList.Remove(p.Arg <Profile>())); _personServiceMock.GetHomeAddress(new Person()).ReturnsForAnyArgs(new PersonalAddress() { Latitude = "1", Longitude = "2" }); _dmzRepoMock.WhenForAnyArgs(x => x.Insert(new Profile())).Do(t => _dmzProfileList.Add(t.Arg <Profile>())); _dmzProfileList = new List <Profile>(); _masterPersonList = new List <Person>() { new Person() { Id = 1, IsActive = true, FirstName = "Test", LastName = "Testesen", Initials = "TT", FullName = "Test Testesen [TT]", Employments = new List <Employment>() { new Employment() { Id = 1, PersonId = 1, Position = "Tester", OrgUnit = new OrgUnit() { LongDescription = "IT Minds" } } } }, new Person() { Id = 2, FirstName = "Lars", IsActive = true, LastName = "Testesen", Initials = "LT", FullName = "Lars Testesen [LT]", Employments = new List <Employment>() { new Employment() { Id = 1, PersonId = 2, Position = "Tester2", OrgUnit = new OrgUnit() { LongDescription = "IT Minds" } } } }, new Person() { Id = 3, IsActive = true, FirstName = "Preben", LastName = "Testesen", Initials = "PT", FullName = "Preben Testesen [PT]", Employments = new List <Employment>() { new Employment() { Id = 1, PersonId = 3, Position = "Tester3", OrgUnit = new OrgUnit() { LongDescription = "IT Minds" } } } } }; _masterRepoMock.AsQueryable().ReturnsForAnyArgs(_masterPersonList.AsQueryable()); _dmzRepoMock.AsQueryable().ReturnsForAnyArgs(_dmzProfileList.AsQueryable()); _uut = new PersonSyncService(_dmzRepoMock, _masterRepoMock, _personServiceMock); }
public PersonSyncService(IGenericDmzRepository <Profile> dmzProfileRepo, IGenericRepository <Person> masterPersonRepo, IPersonService personService) { _dmzProfileRepo = dmzProfileRepo; _masterPersonRepo = masterPersonRepo; _personService = personService; }
public MobileTokenService(IGenericRepository <MobileToken> repo, IGenericDmzRepository <Token> tokenRepo) { _repo = repo; _tokenRepo = tokenRepo; }
public AppLoginService(IGenericDmzRepository <UserAuth> dmzUserRepository) { _dmzUserRepository = dmzUserRepository; }
public void SetUp() { _emplRepo = NSubstitute.Substitute.For <IGenericRepository <Employment> >(); _logger = NSubstitute.Substitute.For <ILogger>(); _dmzRepoMock = NSubstitute.Substitute.For <IGenericDmzRepository <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 RateSyncService(IGenericDmzRepository <Rate> dmzRateRepo, IGenericRepository <Core.DomainModel.Rate> masterRateRepo) { _dmzRateRepo = dmzRateRepo; _masterRateRepo = masterRateRepo; }