public FATCAGenerator(IFATCAProcesor procesor, IAppConfiguration configuration, IApplicationLog applicationLog) { InitializeComponent(); this.procesor = procesor; this.configuration = configuration; this.applicationLog = applicationLog; LogSource = new BindingSource(); }
public void SetUp() { var log = new Mock <IApplicationLog>(); Log = log.Object; var repo = new Mock <IRepository>(); repo.Setup(m => m.AddRestaurentGetNewId(It.IsAny <AddRestaurantRequestModel>())) .Returns <AddRestaurantRequestModel>(r => FakeAddRestaurant(r)); repo.Setup(m => m.DoseRestaurentNameAlreadyExist(It.IsAny <string>())) .Returns <string>(r => FakeResturantExisits(r)); repo.Setup(m => m.DoseRestaurentIdExist(It.IsAny <int>())) .Returns <int>(id => FakeResturantIdExisits(id)); repo.Setup(m => m.RemoveRestaurentId(It.IsAny <RemoveRestaurantRequestModel>())) .Callback <RemoveRestaurantRequestModel>(r => FakeRemoveRestaurant(r)); repo.Setup(m => m.GetRestaurantById(It.IsAny <int>())) .Returns <int>(id => FakeGetRestaurantById(id)); repo.Setup(m => m.GetRestaurantWithReviewsById(It.IsAny <int>())) .Returns <int>(r => FakeGetRestaurantWithReviewesById(r)); repo.Setup(m => m.GetReviewsForRestaurant(It.IsAny <int>())) .Returns <int>(r => FakeGetReviewsForRestaurant(r)); repo.Setup(m => m.AddReviewGetNewId(It.IsAny <AddReviewRequestModel>())) .Returns <AddReviewRequestModel>(r => FakeAddReview(r)); repo.Setup(m => m.GetUserById(It.IsAny <int>())) .Returns <int>(id => Users[id - 1]); repo.Setup(m => m.DoseUserIdAlreadyExist(It.IsAny <int>())) .Returns <int>(id => id <= Users.Count && id > 0); repo.Setup(m => m.UpdateRestaurant(It.IsAny <UpdateRestaurantRequestModel>())) .Callback <UpdateRestaurantRequestModel>(r => FakeUpdateRestaurant(r)); repo.Setup(m => m.GetCuisineById(It.IsAny <int>())) .Returns <int>(id => Cuisines[id]); repo.Setup(m => m.DoseCuisineIdExist(It.IsAny <int>())) .Returns <int>(id => (id > 0 && id <= Cuisines.Count)); repo.Setup(m => m.GetAllRestaurantsWithReview()) .Returns(FakeGetAllRestaurants()); repo.Setup(m => m.GetAllCuisines()) .Returns(Cuisines); repo.Setup(m => m.GetRestaurantForCuisine(It.IsAny <int>())) .Returns <int>(id => FakeGetRestaurantsForCuisineId(id)); Repo = repo.Object; }
public static void EnableLogging(Type callingType) { IApplicationLog log = ApplicationLog.GetLogger(log4net.LogManager.GetLogger(callingType), null); if (log.IsInfoEnabled) { log.Info("Started Logging"); } }
public SimpleFATCAParser(IFATCAValidator FATCAValidator, IFATCAMapper FATCAMapper, IApplicationLog applicationLog) { if (FATCAValidator == null) { throw new ArgumentNullException("IFATCAValidator null reference"); } if (FATCAMapper == null) { throw new ArgumentNullException("IFATCAMapper null reference"); } this.FATCAValidator = FATCAValidator; this.FATCAMapper = FATCAMapper; this.applicationLog = applicationLog; }
public static void InitDefault(IApplicationLog log, ISettingsProvider settingsProvider) { InMemoryLogWriter tempWriter = log.LogWriters.OfType <InMemoryLogWriter>().FirstOrDefault(); if (tempWriter != null) { log.LogWriters.Remove(tempWriter); foreach (ILogEntry entry in tempWriter.Entries) { log.AddEntry(entry); } } log.LogFilters.Add(new WhiteSourceLogFilter(settingsProvider)); log.LogFilters.Add(new BlackSourceLogFilter("Recording Polling", settingsProvider)); log.LogFilters.Add(new MessageLevelLogFilter(settingsProvider)); }
private CustomerAbuse CreateCustomerAbuse( Mock <ILandingPageAssignContent> landingPageAssignContent = null, IApplicationLog applicationLog = null, Mock <IMasterCommunicator> master = null) { if (master == null) { master = new Mock <IMasterCommunicator>(); master.Setup(x => x.GetUserID()).Returns(DummyUserID); master.Setup(x => x.GetCustomerID()).Returns(DummyCustomerID); master.Setup(x => x.GetCurrentUser()).Returns(new User()); } var landingPageAssign = new Mock <ILandingPageAssign>(); landingPageAssign.Setup(x => x.Save(It.IsAny <LandingPageAssign>(), It.IsAny <User>())); var dataTable = new DataTable(); dataTable.Columns.Add(new DataColumn()); dataTable.Rows.Add(dataTable.NewRow()); landingPageAssign.Setup(x => x.GetPreviewParameters(It.IsAny <int>(), It.IsAny <int>())).Returns(dataTable); if (landingPageAssignContent == null) { landingPageAssignContent = new Mock <ILandingPageAssignContent>(); landingPageAssignContent.Setup(x => x.Save(It.IsAny <LandingPageAssignContent>(), It.IsAny <User>())); landingPageAssignContent.Setup(x => x.Delete(It.IsAny <int>(), It.IsAny <User>())); } _response = new Mock <HttpResponseBase>(); _response.Setup(x => x.Redirect("CustomerMain.aspx")); var customerAbuse = new CustomerAbuse( master.Object, landingPageAssign.Object, landingPageAssignContent.Object, _response.Object, applicationLog); return(customerAbuse); }
public FATCAProcesor(IFATCADataProvider FATCADataProvider, IFATCAParser FATCAParser, IFATCAFileGenerator FATCAFileGenerator, IApplicationLog applicationLog) { if (FATCADataProvider == null) { throw new ArgumentNullException("IFATCADataProvider null reference"); } if (FATCAParser == null) { throw new ArgumentNullException("IFATCAParser null reference"); } if (FATCAFileGenerator == null) { throw new ArgumentNullException("IFATCAFileGenerator null reference"); } this.FATCADataProvider = FATCADataProvider; this.FATCAParser = FATCAParser; this.FATCAFileGenerator = FATCAFileGenerator; this.applicationLog = applicationLog; }
public CSVFATCADataProvider(IAppConfiguration appConfiguration, IApplicationLog applicationLog) { _appConfiguration = appConfiguration; this.applicationLog = applicationLog; }
public ControllerBase(IRepository repo, IApplicationLog logger, IIdentityProvider identity) { Logger = logger; Factory = new TransactionFactory(repo, logger, identity); }
private BaseChannelAbuse CreateChannel( ILandingPageOption landingPageOption = null, bool isUserActive = true, IApplicationLog applicationLog = null, Mock <ILandingPageAssignContent> landingPageAssignContent = null, Mock <IMasterCommunicator> master = null) { if (master == null) { master = new Mock <IMasterCommunicator>(); master.Setup(x => x.GetUserID()).Returns(DummyUserID); master.Setup(x => x.GetBaseChannelID()).Returns(DummyBaseChannelID); master.Setup(x => x.GetCurrentUser()) .Returns(new User() { IsActive = isUserActive, CurrentSecurityGroup = new SecurityGroup() { AdministrativeLevel = SecurityGroupAdministrativeLevel.ChannelAdministrator } }); } var landingPageAssign = new Mock <ILandingPageAssign>(); landingPageAssign.Setup(x => x.Save(It.IsAny <LandingPageAssign>(), It.IsAny <User>())); var dataTable = new DataTable(); dataTable.Columns.Add(new DataColumn()); dataTable.Columns.Add(new DataColumn()); var dataRow = dataTable.NewRow(); dataRow.ItemArray = new object[] { BlastId, EmailId }; dataTable.Rows.Add(dataRow); landingPageAssign.Setup(x => x.GetPreviewParameters(It.IsAny <int>(), It.IsAny <int>())).Returns(dataTable); landingPageAssign.Setup(x => x.GetByBaseChannelID(It.IsAny <int>(), LandingPageID)) .Returns(new LandingPageAssign() { LPAID = LandingPageID, BaseChannelDoesOverride = true, CustomerCanOverride = true, Header = NonEmptyText, Footer = NonEmptyText }); if (landingPageAssignContent == null) { landingPageAssignContent = new Mock <ILandingPageAssignContent>(); landingPageAssignContent.Setup(x => x.Save(It.IsAny <LandingPageAssignContent>(), It.IsAny <User>())); landingPageAssignContent.Setup(x => x.Delete(It.IsAny <int>(), It.IsAny <User>())); landingPageAssignContent.Setup(x => x.GetByLPAID(It.IsAny <int>())) .Returns(new List <LandingPageAssignContent>() { new LandingPageAssignContent() { LPOID = LandingPageID, Display = NonEmptyText } }); } _response = new Mock <HttpResponseBase>(); _response.Setup(x => x.Redirect("BaseChannelMain.aspx")); return(new BaseChannelAbuse( master.Object, landingPageAssign.Object, landingPageAssignContent.Object, _response.Object, landingPageOption, applicationLog)); }
public PartialUpdateRestaurantTransaction(IRepository repo, IApplicationLog log, UpdateRestaurantRequestModel reqeustModel) : base(repo, log, reqeustModel) { }
protected Transaction(IRepository repo, IApplicationLog log, T reqeustModel) { Request = reqeustModel; Repository = repo; ApplicationLog = log; }
public CuisinesController(IRepository repo, IApplicationLog logger, IIdentityProvider identity) : base(repo, logger, identity) { }
public AddReviewTransaction(IRepository repo, IApplicationLog log, AddReviewRequestModel reqeustModel) : base(repo, log, reqeustModel) { }
public RemoveRestaurantTransaction(IRepository repo, IApplicationLog log, RemoveRestaurantRequestModel requestModel) : base(repo, log, requestModel) { }
public TransactionFactory(IRepository repo, IApplicationLog log, IIdentityProvider identity) { _repo = repo; _log = log; _identity = identity; }
public XMLFATCAGenerator(IAppConfiguration appConfiguration, IApplicationLog applicationLog) { this.appConfiguration = appConfiguration; this.applicationLog = applicationLog; }
public ViewReviewsForRestaurantTransaction(IRepository repo, IApplicationLog log, ViewRestaurantRequestModel reqeustModel) : base(repo, log, reqeustModel) { }
public AddRestaurantTransaction(IRepository repo, IApplicationLog log, AddRestaurantRequestModel req) : base(repo, log, req) { }
public ViewRestaurantsForCuisineTransaction(IRepository repo, IApplicationLog log, ViewRestaurantsForCuisineRequestModel reqeustModel) : base(repo, log, reqeustModel) { }
public SImpleFATCAValidator(IApplicationLog applicationLog) { this.applicationLog = applicationLog; }
public ViewCuisinesTransaction(IRepository repo, IApplicationLog log, ViewCuisinesRequestModel reqeustModel) : base(repo, log, reqeustModel) { }
public static void Init( IApplicationLog applicationLog, Func <ILogWriter, IApplicationWatchdog> initWatchdog, Func <ILogWriter, IExceptionHandler> initExceptionHandler, Func <ILogWriter, IAgentIdentity> initAgentIdentity, Func <ILogWriter, IAgentIdentity, ISettingsProvider> initSettingsProvider, Action <ISettingsProvider, IApplicationLog, IAgentIdentity> initApplicationLog, Func <IExceptionHandler, ILogWriter, ISettingsProvider, IAgentIdentity, IApplicationWatchdog, IApplicationServiceBus> loadServiceBus, Action onShutDown) { if (applicationLog == null) { throw new ArgumentNullException("applicationLog"); } if (initWatchdog == null) { throw new ArgumentNullException("initWatchdog"); } if (initApplicationLog == null) { throw new ArgumentNullException("initApplicationLog"); } if (initExceptionHandler == null) { throw new ArgumentNullException("initExceptionHandler"); } if (initSettingsProvider == null) { throw new ArgumentNullException("initSettingsProvider"); } if (initAgentIdentity == null) { throw new ArgumentNullException("initAgentIdentity"); } if (onShutDown == null) { throw new ArgumentNullException("onShutDown"); } if (loadServiceBus == null) { throw new ArgumentNullException("loadServiceBus"); } _onShutDown = onShutDown; IApplicationWatchdog watchdog = initWatchdog(applicationLog); watchdog.BeatDog(); _exceptionHandler = initExceptionHandler(applicationLog); _agentIdentity = initAgentIdentity(applicationLog); applicationLog.AddEntry( new LogEntry( MessageLevel.AppLifecycle, ThisClassName, string.Format("Agent {0} started.", _agentIdentity.ID))); _settingsProvider = initSettingsProvider(applicationLog, _agentIdentity); initApplicationLog(_settingsProvider, applicationLog, _agentIdentity); _applicationLog = applicationLog; _serviceBus = loadServiceBus(_exceptionHandler, applicationLog, _settingsProvider, _agentIdentity, watchdog); _settingsProvider.SettingsChanged += SettingsProvider_SettingsChanged; }