public void Run_InvalidFlagValue_ShouldThrowItemException(string flagValue) { //arrange const string expectedError = "Unknown flag value"; Item fakeContextItem = ItemHelper.CreateItem("GAG_GECO ChangeControlled", string.Empty); Item fakeAffectedItem = ItemHelper.CreateItem("GAG_GrammerChangeControlled", "get"); fakeAffectedItem.setProperty("gag_migration_edit_flag", flagValue); IDataAccessLayer fakeDal = Substitute.For <IDataAccessLayer>(); fakeDal.ApplyItem(Arg.Any <Item>()).Returns(fakeAffectedItem); fakeDal.NewItem("GAG_GrammerChangeControlled", "get").Returns(fakeAffectedItem); fakeDal.NewError(Arg.Any <string>()).Returns(ci => { Item error = ItemHelper.CreateItem(string.Empty, string.Empty); error.loadAML(string.Format(CultureInfo.CurrentCulture, ErrorResultTemplate, ci.ArgAt <string>(0))); return(error); }); var testClass = new TestClass(fakeDal); //act //assert ItemException exception = Assert.Throws <ItemException>(() => testClass.Run(fakeContextItem)); string actualError = exception?.ErrorItem?.getErrorString(); Assert.AreEqual(actualError, expectedError); }
public Perceptron() { /////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////// THAT CODE WILL RUN THE CPU FILES(*Cpu.cs/*CPU.cs) FOR PROCESSING THE JOB///////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// _pstFilter = new PstFilterCpu(); _pstGenerator = new PstGeneratorCpu(); _dataLayer = new SQLDatabase(); _wholeProteinMassTuner = new WholeProteinMassTunerCpu(); _molecularWeightModule = new MwModule(); _proteinRepository = new ProteinRepositorySql(); _postTranslationalModificationModule = new PtmCpu(); _insilicoFragmentsAdjustment = new InsilicoFragmentsAdjustmentCpu(); _insilicoFilter = new InsilicoFilterCpu(); _peakListFileReader = new PeakListFileReader(); /////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////// THAT CODE WILL RUN THE GPU FILES(*Gpu.cs/*GPU.cs) FOR PROCESSING THE JOB///////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// ////_pstFilter = new PstFilterGpu(); //_pstGenerator = new PstGeneratorGpu(); //_dataLayer = new SQLDatabase(); //_wholeProteinMassTuner = new WholeProteinMassTunerGpu(); //_molecularWeightModule = new MwModule(); //_proteinRepository = new ProteinRepositorySql(); //_postTranslationalModificationModule = new PtmCpu(); //_insilicoFragmentsAdjustment = new InsilicoFragmentsAdjustmentCpu(); //_insilicoFilter = new InsilicoFilterCpu(); //_peakListFileReader = new PeakListFileReader(); }
public static IUnityContainer Setup(out IDataAccessLayer dbContext) { var container = new UnityContainer(); const string databaseName = DatabasePath; dbContext = new Db4OContext(); dbContext.Setup(databaseName); //database registration container.RegisterInstance(typeof(IDataAccessLayer), dbContext); //service registrations container.RegisterType <IFileSystemService, FileSystemService>(); container.RegisterType <IDatabaseService, DatabaseService>(); container.RegisterType <IFileWatcherService, FileWatcherService>(); //registraions utils //only one instance from messenger can exists! (recipient problems..) var messenger = new Messenger(); container.RegisterInstance(typeof(IMessenger), messenger); return(container); }
private void btnEdit_Click(object sender, EventArgs e) { OpenFileDialog op1 = new OpenFileDialog(); op1.Filter = "Json Files| *.json;"; op1.Multiselect = false; DialogResult result = op1.ShowDialog(); DataModel data = null; if (result == DialogResult.OK) { string fName = op1.FileName; try { IDataAccessLayer readFile = DataAccessFactory.Create(0); data = readFile.Get <DataModel>(fName); ShowDataTocontrols(data); } catch (Exception) { MessageBox.Show("Error in Reading File: " + op1.FileName); } } else { MessageBox.Show("Please Select File"); } }
protected override void OnStartup(StartupEventArgs e) { Container = new UnityContainer(); _dbContext = new NDatabaseConnector(AppDirectory); //database registration Container.RegisterInstance(typeof(IDataAccessLayer), _dbContext); //service registrations Container.RegisterType <IDatabaseService, DatabaseService>(); Container.RegisterType <IImageService, ImageService>(); Container.RegisterType <IDataService, DataService>(); Container.RegisterType <IGoogleDriveService, GoogleDriveService>(); Container.RegisterType <IFtpService, FtpService>(); Container.RegisterType <IJsonService, JsonService>(); Container.RegisterType <IConfigService, ConfigService>(); //registraions utils //only one instance from messenger can exists! (recipient problems..) var messenger = new Messenger(); Container.RegisterInstance(typeof(IMessenger), messenger); var mainView = Container.Resolve <MainWindow>(); mainView.Show(); }
protected override void OnStartup(StartupEventArgs e) { XmlConfigurator.Configure(); _logger.Info("[START]"); _logger.Info("setup dependency injection container"); Container = new UnityContainer(); _logger.Info("setup database"); string directory = Environment.GetFolderPath( Environment.SpecialFolder.LocalApplicationData); _logger.Info("database directory: " + directory); _dbContext = new NDatabaseConnector(directory); //database registration Container.RegisterInstance(typeof(IDataAccessLayer), _dbContext); //service registrations Container.RegisterType <ICryptographyService, CryptographyService>(); Container.RegisterType <IDropboxService, DropboxService>(); //registraions utils //only one instance from messenger can exists! (recipient problems..) _logger.Info("register messenger instance"); var messenger = new Messenger(); Container.RegisterInstance(typeof(IMessenger), messenger); _logger.Info("show login view"); var loginView = Container.Resolve <LoginView>(); loginView.Show(); }
protected override void OnStartup(StartupEventArgs e) { XmlConfigurator.Configure(); _logger.Info("[START]"); _logger.Info("setup dependency injection container"); Container = new UnityContainer(); _logger.Info("setup database"); string directory = Environment.GetFolderPath( Environment.SpecialFolder.LocalApplicationData); _logger.Info("database directory: " + directory); _dbContext = new NDatabaseConnector(directory); //database registration Container.RegisterInstance(typeof (IDataAccessLayer), _dbContext); //service registrations Container.RegisterType<ICryptographyService, CryptographyService>(); Container.RegisterType<IDropboxService, DropboxService>(); //registraions utils //only one instance from messenger can exists! (recipient problems..) _logger.Info("register messenger instance"); var messenger = new Messenger(); Container.RegisterInstance(typeof (IMessenger), messenger); _logger.Info("show login view"); var loginView = Container.Resolve<LoginView>(); loginView.Show(); }
private void btnSaveTemplate_Click(object sender, EventArgs e) { SaveFileDialog saveTemplateDialog = new SaveFileDialog(); saveTemplateDialog.ShowDialog(); saveTemplateDialog.Title = "Save Site Template"; saveTemplateDialog.Filter = "Json Files| *.json;"; saveTemplateDialog.InitialDirectory = @"C:\"; saveTemplateDialog.CheckFileExists = true; saveTemplateDialog.CheckPathExists = true; if (saveTemplateDialog.FileName != "") { string filename = saveTemplateDialog.FileName; if (siteDataModel == null) { GetDataFromControls(); } IDataAccessLayer writeFile = DataAccessFactory.Create(0); writeFile.Save(filename, siteDataModel); MessageBox.Show("Template saved successfully"); } else { MessageBox.Show("Please Enter Filename"); } }
public void Run_WhenContextItemHasDifferentFlagValue_ShouldThrowItemException() { //arrange const string expectedError = "The property gag_migration_edit_flag cannot be changed"; Item fakeContextItem = ItemHelper.CreateItem("CAD", string.Empty); fakeContextItem.setProperty("gag_migration_edit_flag", "0"); fakeContextItem.setProperty("config_id", GenerateConfigId()); Item fakeLatestItem = ItemHelper.CreateItem("CAD", string.Empty); fakeLatestItem.setProperty("gag_migration_edit_flag", "1"); fakeLatestItem.setProperty("config_id", GenerateConfigId()); IDataAccessLayer fakeDal = Substitute.For <IDataAccessLayer>(); fakeDal.ApplyItem(Arg.Any <Item>()).Returns(fakeLatestItem); fakeDal.NewItem(Arg.Any <string>(), Arg.Any <string>()).Returns(ItemHelper.CreateItem("CAD", string.Empty)); var testClass = new TestClass(fakeDal); //act //assert ItemException exception = Assert.Throws <ItemException>(() => testClass.Run(fakeContextItem)); string actualError = exception.Message; Assert.AreEqual(actualError, expectedError); }
public void Run_WhenLatestItemNotFound_ShouldReturnContextItem() { //arrange Item fakeContextItem = ItemHelper.CreateItem("CAD", string.Empty); fakeContextItem.setProperty("gag_migration_edit_flag", "1"); fakeContextItem.setProperty("config_id", GenerateConfigId()); fakeContextItem.setNewID(); Item errorItem = ItemHelper.CreateItem(string.Empty, string.Empty); errorItem.loadAML(EmptyResult); IDataAccessLayer fakeDal = Substitute.For <IDataAccessLayer>(); fakeDal.NewItem(Arg.Any <string>(), Arg.Any <string>()).Returns(ItemHelper.CreateItem("CAD", string.Empty)); fakeDal.ApplyItem(Arg.Any <Item>()).Returns(errorItem); var testClass = new TestClass(fakeDal); //act Item actualItem = testClass.Run(fakeContextItem); //assert Assert.AreEqual(actualItem.getID(), fakeContextItem.getID()); }
public AssociationRulesTaskProcessor(LispMinerConnector lmConnector, IDataAccessLayer data, IConfiguration configuration, RulesPruner pruner) { _lmConnector = lmConnector; _data = data; _configuration = configuration; _pruner = pruner; }
public static async Task <IEnumerable <T> > PullAsync <T>(IDataAccessLayer dal, QueryBundle query) where T : class, IDbEntity { IEnumerable <T> entities = await dal.GetEntities <T>(query); MarkPersisted(entities, query.Projection.GetType()); return(entities); }
public void initialize() { var section = (UnityConfigurationSection)ConfigurationManager.GetSection("unity"); _container = new UnityContainer().LoadConfiguration(section); _dataAccessLayer = _container.Resolve <IDataAccessLayer>(); }
public EquipmentContractValidator(IDataAccessLayer <EquipmentContract> dal, IValidator <Equipment> equipmentValidator, IValidator <Core.Contract> contractValidator) { _dal = dal; _equipmentValidator = equipmentValidator; _contractValidator = contractValidator; }
public virtual async Task <IEnumerable <string> > PushAsync(IDataAccessLayer dal, int action, int commentId) { if (_tracker == null) { throw new ArgumentNullException("You cannot push the changes of an entity without first starting to edit it."); } return(await PushAsync(_tracker, dal, action, commentId)); }
public ContractValidator(IValidator <Customer> customerValidator, IValidator <Department> departmentValidator, IDataAccessLayer <Core.Contract> dal) { _customerValidator = customerValidator; _departmentValidator = departmentValidator; _dal = dal; }
public static void MyClassCleanup() { _context.ClearDb(DatabaseName); _context.Close(); _context = null; _container.Dispose(); _container = null; }
public static async Task <IEnumerable <T> > PullAsync <T, P>(IDataAccessLayer dal, IEnumerable <Tuple <string, object>[]> primaryKeys) where T : class, IDbEntity where P : class, IDbEntityProjection { IEnumerable <T> entities = await dal.GetMultipleEntities <T>(primaryKeys, typeof(P)); MarkPersisted(entities, typeof(P)); return(entities); }
/// <summary> /// Standard starting point for Unity scripts. /// </summary> IEnumerator Start() { IDataAccessLayer dataLayer = null; #if CHILLICONNECT_ENABLED var sdk = new ChilliConnectSdk(chilliConnectAppToken, false); string userId = default,
public AddEditContactViewModel(IMessenger messenger, IDataAccessLayer database, ICryptographyService cryptographyService) { _messenger = messenger; _database = database; _cryptographyService = cryptographyService; _messenger.Register <AddEditContactConfirmMsg>(this, OnAddEditContactConfirmMsg); }
public AddEditContactViewModel(IMessenger messenger, IDataAccessLayer database, ICryptographyService cryptographyService) { _messenger = messenger; _database = database; _cryptographyService = cryptographyService; _messenger.Register<AddEditContactConfirmMsg>(this, OnAddEditContactConfirmMsg); }
public void mock_dal_should_return_fake_Camera_data_by_ID() { IDataAccessLayer dal = ueb.GetDataAccessLayer(); AssertNotNull("GetDataAccessLayer", dal); ICameraModel obj = dal.GetCamera(1234); AssertNotNull("dal.GetCamera", obj); }
public UploadControllerEngine(IDataAccessLayer data, IDatasetViewModelMapper datasetMapper, IAttributeViewModelMapper attributeMapper, IFileHandler fileHandler, IStarSchemaBuilder starSchemaBuilder, IStarSchemaQuerier starSchemaQuerier) : base(data, starSchemaQuerier) { _attributeMapper = attributeMapper; _starSchemaBuilder = starSchemaBuilder; _fileHandler = fileHandler; _datasetMapper = datasetMapper; }
public decimal AmoutProductInWarehouse(int Code) { using (var scope = Program.Container.BeginLifetimeScope()) { IDataAccessLayer ds = scope.Resolve <IDataAccessLayer>(); Product[] basket = ds.GetAll(); int amoutProduct = (from p in basket where p.Code == Code select p).Count(); return(amoutProduct); } }
public void mock_dal_should_return_fake_Photographers_data_by_ID() { IDataAccessLayer dal = ueb.GetDataAccessLayer(); AssertNotNull("GetDataAccessLayer", dal); IPhotographerModel obj = dal.GetPhotographer(1234); AssertNotNull("dal.GetPhotographer", obj); }
private static void ResolveIocDependencies(UnityContainer container) { _errorReporter = container.Resolve <IErrorReporter>(); _dataAccessLayer = container.Resolve <IDataAccessLayer>(); var repositoryFactory = container.Resolve <IRepositoryFactory>(); repositoryFactory.EnableTracing(new TraceWriterFactory()); repositoryFactory.EnableAnalyticRecording(new AnalyticRecorderFactory()); }
public void mock_dal_should_return_fake_Pictures_data_by_ID() { IDataAccessLayer dal = ueb.GetDataAccessLayer(); AssertNotNull("GetDataAccessLayer", dal); IPictureModel obj = dal.GetPicture(1234); AssertNotNull("dal.GetPicture", obj); }
public static void MyClassCleanup() { _context.ClearDb(DatabaseName); _context.Close(); _context = null; _container.Dispose(); _container = null; Directory.Delete(DesktopTestDirectory, true); }
public void mock_dal_should_return_fake_Camera_data() { IDataAccessLayer dal = ueb.GetDataAccessLayer(); AssertNotNull("GetDataAccessLayer", dal); IEnumerable <ICameraModel> lst = dal.GetCameras(); AssertNotNull("dal.GetCameras", lst); AssertTrue("dal.GetCameras returned nothing", lst.Count() > 0); }
public ContactsViewModel(IDataAccessLayer database, IMessenger messenger) { _database = database; _messenger = messenger; _messenger.Register<AddEditContactViewClosedMsg>(this, OnAddEditContactViewClosedMsg); _messenger.Register<SaveContactMsg>(this, OnSaveContactMsg); _messenger.Register<DeleteContactConfirmMsg>(this, OnDeleteContactConfirmMsg); Contacts = _database.GetAll<Contact>(); }
public void mock_dal_should_return_fake_Pictures_data() { IDataAccessLayer dal = ueb.GetDataAccessLayer(); AssertNotNull("GetDataAccessLayer", dal); IEnumerable <IPictureModel> lst = dal.GetPictures(null, null, null, null); AssertNotNull("dal.GetPictures", lst); AssertTrue("dal.GetPictures returned nothing", lst.Count() > 0); }
public void mock_dal_should_return_fake_Photographers_data() { IDataAccessLayer dal = ueb.GetDataAccessLayer(); AssertNotNull("GetDataAccessLayer", dal); IEnumerable <IPhotographerModel> lst = dal.GetPhotographers(); AssertNotNull("dal.GetPhotographers", lst); AssertTrue("dal.GetPhotographers returned nothing", lst.Count() > 0); }
public ContactsViewModel(IDataAccessLayer database, IMessenger messenger) { _database = database; _messenger = messenger; _messenger.Register <AddEditContactViewClosedMsg>(this, OnAddEditContactViewClosedMsg); _messenger.Register <SaveContactMsg>(this, OnSaveContactMsg); _messenger.Register <DeleteContactConfirmMsg>(this, OnDeleteContactConfirmMsg); Contacts = _database.GetAll <Contact>(); }
public static void CreateTestAccounts(IDataAccessLayer dal) { Account act = new Account( new HumanAcccountHolder("test", "test", new string[] { "some", "test", "guy" }), 0d, 100d, AvailableCurrencies.CurrencyList[0] ); dal.SaveAccount(act); Account act2 = new Account( new HumanAcccountHolder("test2", "test2", new string[] { "Totally", "Awesome", "Tester" }), 0d, 133.25d, AvailableCurrencies.CurrencyList[0] ); dal.SaveAccount(act2); Account act3 = new Account( new HumanAcccountHolder("test3", "test3", new string[] { "More", "People", "Fortesting" }), 0d, 133.25d, AvailableCurrencies.CurrencyList[0] ); dal.SaveAccount(act3); Account act4 = new Account( new HumanAcccountHolder("test4", "test4", new string[] { "Group", "Of", "Testination" }), 0d, 133.25d, AvailableCurrencies.CurrencyList[0] ); dal.SaveAccount(act4); Account act5 = new Account( new HumanAcccountHolder("test5", "test5", new string[] { "Major", "Testz", "Sotested" }), 0d, 133.25d, AvailableCurrencies.CurrencyList[0] ); dal.SaveAccount(act5); Account act6 = new Account( new HumanAcccountHolder("test6", "test6", new string[] { "Captain", "Testing", "Ofthetestiverse" }), 0d, 133.25d, AvailableCurrencies.CurrencyList[0] ); dal.SaveAccount(act6); Account cact = new Account( new CompanyAccountHolder("admin", "admin", new string[] { "An ", "Admin", "Dude" }), 0d, 100d, AvailableCurrencies.CurrencyList[0] ); dal.SaveAccount(cact); }
protected override void OnStartup(StartupEventArgs e) { BasicConfigurator.Configure(); Container = new UnityContainer(); string databaseName = Settings.Default.DatabasePath; _dbContext = new Db4OContext(); _dbContext.Setup(databaseName); //database registration Container.RegisterInstance(typeof (IDataAccessLayer), _dbContext); //service registrations Container.RegisterType<IFileSystemService, FileSystemService>(); Container.RegisterType<IDatabaseService, DatabaseService>(); Container.RegisterType<IFileWatcherService, FileWatcherService>(); //registraions utils //only one instance from messenger can exists! (recipient problems..) var messenger = new Messenger(); Container.RegisterInstance(typeof (IMessenger), messenger); var mainWindow = Container.Resolve<MainWindow>(); if (Settings.Default.FirstAppStart) { Settings.Default.FirstAppStart = false; Settings.Default.Save(); mainWindow.Show(); } else { //start in system tray icon bar mainWindow.Hide(); } }
public MainViewModel(ICryptographyService cryptographyService, IMessenger messenger, IDataAccessLayer database, IDropboxService dropboxService) { _cryptographyService = cryptographyService; _messenger = messenger; _database = database; _dropboxService = dropboxService; //register for messages _messenger.Register<AssignNewKeysConfirmMsg>(this, OnAssignNewKeysConfirmMsg); _messenger.Register<ExportPublicKeyConfirmMsg>(this, OnExportPublicKeyConfirmMsg); _messenger.Register<ContactsViewClosedMsg>(this, OnContactsViewClosedMsg); _messenger.Register<ChooseSourceConfirmMsg>(this, OnChooseSourceConfirmMsg); _messenger.Register<ChooseTargetConfirmMsg>(this, OnChooseTargetConfirmMsg); _messenger.Register<ContactSelectedMsg>(this, OnContactSelectedMsg); _messenger.Register<ConnectDropboxViewClosedMsg>(this, OnConnectDropboxViewClosedMsg); _messenger.Register<DropboxAccessTokenSavedMsg>(this, OnDropboxAccessTokenSavedMsg); _messenger.Register<FileListViewClosedMsg>(this, OnFileListViewClosedMsg); _messenger.Register<DropboxFileDownloadFinishedMsg>(this, OnDropboxFileDownloadFinishedMsg); _messenger.Register<EncryptionSuccsessMsg>(this, OnEncryptionSuccsessMsg); CheckDropboxAccess(); }
public static IUnityContainer Setup(out IDataAccessLayer dbContext) { var container = new UnityContainer(); const string databaseName = DatabasePath; dbContext = new Db4OContext(); dbContext.Setup(databaseName); //database registration container.RegisterInstance(typeof (IDataAccessLayer), dbContext); //service registrations container.RegisterType<IFileSystemService, FileSystemService>(); container.RegisterType<IDatabaseService, DatabaseService>(); container.RegisterType<IFileWatcherService, FileWatcherService>(); //registraions utils //only one instance from messenger can exists! (recipient problems..) var messenger = new Messenger(); container.RegisterInstance(typeof (IMessenger), messenger); return container; }
public FileListViewModel(IDataAccessLayer database, IDropboxService dropboxService, IMessenger messenger) { _database = database; _dropboxService = dropboxService; _messenger = messenger; }
public static void MyClassCleanup() { _context.ClearDb(DatabaseName); _context = null; }
public static void MyClassInitialize(TestContext testContext) { _context = new Db4OContext(); _context.Setup(DatabaseName); _context.ClearDb(DatabaseName); }
public InquiryResult PerformInquiry(Account selectedAccount, Command toPerform, IDataAccessLayer dal, params string[] parameters) { List<string> responses = new List<string>(); List<string> followUps = new List<string>(); switch (toPerform.Inquiry) { case TransactionTypes.ListAccounts: List<Account> foundAccounts = new List<Account>(); int numberToLoad = 5; int.TryParse(parameters[0], out numberToLoad); bool descOrder = true; if (parameters != null && parameters.Count() > 1 && parameters[1] == "asc") descOrder = false; if (descOrder) foundAccounts.AddRange(dal.HighestAccounts(numberToLoad)); else foundAccounts.AddRange(dal.LowestAccounts(numberToLoad)); foreach (Account act in foundAccounts) { responses.Add(string.Format("Account {0} has {1} in it and is owned by {2}", act.Id, act.Balance.ToString(), act.Owner.DisplayName)); } break; case TransactionTypes.GetAccountAtDate: if (parameters != null && parameters.Count() > 0) { DateTime targetDate = DateTime.MinValue; if(DateTime.TryParse(parameters[0], out targetDate)) { if (selectedAccount.TransactionHistory.Count() > 0) { List<Transaction> allTransInOrder = selectedAccount.TransactionHistory.OrderBy(x => x.Time).ToList(); Transaction lastTransaction = allTransInOrder[0]; foreach(var t in allTransInOrder) { if (t.Time > lastTransaction.Time && t.Time < targetDate) { lastTransaction = t; } } responses.Add(string.Format("Account {0} had {1} on {2}", selectedAccount.Id, lastTransaction.BalanceAfter, targetDate)); } } } break; default: break; } return new InquiryResult(responses, followUps); }
public DataAccessLayer(IDataAccessLayer dal) { internalDal = dal; }
public PerformanceTest(IDataAccessLayer dataAccessLayer) { _dataAccessLayer = dataAccessLayer; }
public ConnectDropboxViewModel(IDataAccessLayer database, IMessenger messenger, IDropboxService dropboxService) { _database = database; _messenger = messenger; _dropboxService = dropboxService; }
public InquiryResult PerformInquiry(Account selectedAccount, Command toPerform, IDataAccessLayer dal, params string[] parameters) { List<string> responses = new List<string>(); List<string> followUps = new List<string>(); switch (toPerform.Inquiry) { case TransactionTypes.BalanceInquiry: responses.Add(string.Format("Current Balance is: {0}", selectedAccount.Balance)); break; case TransactionTypes.Deposit: double depositing = 0d; if (parameters != null && parameters.Count() > 0 && double.TryParse(parameters[0], out depositing)) { responses.Add(string.Format("Deposited: {0}", depositing)); selectedAccount.PerformTransaction(new Transaction("Deposited Funds", new Money(depositing, selectedAccount.LocalCurrency), toPerform.Inquiry)); } break; case TransactionTypes.Withdrawal: double withdrawing = 0d; if (parameters != null && parameters.Count() > 0 && double.TryParse(parameters[0], out withdrawing)) { responses.Add(string.Format("Withdrew: {0}", withdrawing)); selectedAccount.PerformTransaction(new Transaction("Withdrew Funds", -new Money(withdrawing, selectedAccount.LocalCurrency), toPerform.Inquiry)); } break; case TransactionTypes.ChangeCurrency: Currency toSwitch = selectedAccount.LocalCurrency; if (parameters != null && parameters.Count() > 0) { foreach (Currency c in AvailableCurrencies.CurrencyList) { if (c.Name == parameters[0]) { toSwitch = c; responses.Add(string.Format("Switching to currency: {0}", c.Name)); } } } selectedAccount.SwitchAccountCurrency(toSwitch); responses.Add(string.Format("Completed currency exchange.")); goto case TransactionTypes.BalanceInquiry; default: break; } return new InquiryResult(responses, followUps); }
public static void MyClassInitialize(TestContext testContext) { _dataAccess = new NDatabaseConnector(); }
public InquiryResult PerformInquiry(Account selectedAccount, Command toPerform, IDataAccessLayer dal, params string[] parameters) { return injectedHolder.PerformInquiry(selectedAccount, toPerform, dal, parameters); }
public ChangePasswordViewModel(IDataAccessLayer database, ICryptographyService cryptographyService) { _database = database; _cryptographyService = cryptographyService; }
/// <summary> /// Constructor /// </summary> /// <param name="dataAccessLayer"></param> /// <param name="mapper"></param> public DataProvider(IDataAccessLayer dataAccessLayer, IMapper mapper) { this.dataAccessLayer = dataAccessLayer; this.mapper = mapper; }
public DataAccessLayer(IDataAccessLayer dataLayer) { dal = dataLayer; }
public DataAccessLayer(IDataAccessLayer dal, ISecurity sec) { internalDal = dal; internalSecurity = sec; }
public static AccountHolder DemandAuthentication(IDataAccessLayer dal) { AccountHolder ach = null; bool first = true; while (ach == null) { if (first) { Console.WriteLine("Hello and welcome to our bank software."); first = false; } else { Console.WriteLine("Incorrect Username/Password. Please try again."); } Console.WriteLine("Please enter your username and password:"******"Username:"******"Password:"); string password = Console.ReadLine(); ach = dal.AttemptLogin(username, password); } return ach; }
/// <summary> /// Constructor /// </summary> /// <param name="inferenceModule">Inference module</param> /// <param name="dataAccessLayer">Data access layer</param> public Presenter(IInferenceModule inferenceModule, IDataAccessLayer dataAccessLayer) { this.inferenceModule = inferenceModule; this.dataAccessLayer = dataAccessLayer; }