예제 #1
0
 public RepositoryFacade()
 {
     Users      = new UserRepository();
     Orders     = new OrderRepository();
     Securities = new SecurityRepository();
     Funds      = new FundRepository();
 }
        public void ItShouldLoadFunds()
        {
            IList <Fund> funds = new List <Fund>()
            {
                new Fund {
                    Id = 1, Stock = Stock.Equity, StockName = "Equity1", Price = 10, Quantity = 10, StockWeight = 10
                },
                new Fund {
                    Id = 2, Stock = Stock.Bond, StockName = "Bond1", Price = 5, Quantity = 5, StockWeight = 5
                },
                new Fund {
                    Id = 3, Stock = Stock.Bond, StockName = "Equity2", Price = 20, Quantity = 100, StockWeight = 90
                },
                new Fund {
                    Id = 4, Stock = Stock.Bond, StockName = "Equity3", Price = 20, Quantity = 100, StockWeight = 90
                },
            };

            IFundRepository fundsRepository = new FundRepository();
            MainForm        mockView        = new MainForm(fundsRepository);
            IPresenter      presenter       = mockView.Presenter;

            mockView.LoadFunds(funds);

            NUnit.Framework.Assert.AreEqual(4, mockView.Funds.Count);
        }
예제 #3
0
 public static IEnumerable <Fund> GetFundByProductCode(ProductCode productCode)
 {
     using (FundRepository db = new FundRepository())
     {
         return(db.GetFundsByProductCode(productCode));
     }
 }
예제 #4
0
 public static void ClearFundData()
 {
     using (FundRepository db = new FundRepository())
     {
         db.ClearFundData();
     }
 }
예제 #5
0
 public static void CreateFundWithPerformance(Fund fund)
 {
     using (FundRepository db = new FundRepository())
     {
         db.CreateFundWithPerformance(fund);
     }
 }
        public void ItShouldShowInitialFundList()
        {
            IFundRepository fundsRepository = new FundRepository();
            MainForm        mockView        = new MainForm(fundsRepository);
            IPresenter      presenter       = mockView.Presenter;

            NUnit.Framework.Assert.AreEqual(3, mockView.Funds.Count);
        }
        public void ItShouldFailOnInitialLoad()
        {
            IFundRepository fundsRepository = new FundRepository();
            MainForm        mockView        = new MainForm(fundsRepository);
            IPresenter      presenter       = mockView.Presenter;

            NUnit.Framework.Assert.IsFalse(mockView.Validate());
        }
예제 #8
0
        public FundController()
        {
            string connectionString = Settings.GetStringDB();

            _fundRepository = new FundRepository(connectionString);
            ur = new UserRepository(connectionString);
            _roleRepository = new RoleRepository(connectionString);
        }
        public void ItShouldShowInitialFundListNotNUll()
        {
            IFundRepository fundsRepository = new FundRepository();
            MainForm        mockView        = new MainForm(fundsRepository);
            IPresenter      presenter       = mockView.Presenter;


            NUnit.Framework.Assert.IsNotNull(mockView.Funds);
        }
        public void ItShouldCheckInitialLoadPresenter()
        {
            IFundRepository fundsRepository = new FundRepository();
            MainForm        mockView        = new MainForm(fundsRepository);
            IPresenter      presenter       = mockView.Presenter;


            NUnit.Framework.Assert.AreEqual(3, presenter.Total);
        }
        public void ItShouldReturnObjectToAdd()
        {
            IFundRepository fundsRepository = new FundRepository();
            MainForm        mockView        = new MainForm(fundsRepository);
            IPresenter      presenter       = mockView.Presenter;

            var f = mockView.GetFund();

            NUnit.Framework.Assert.IsNotNull(f);
        }
        public void ItShouldShowInitialFundListObjectsNotNUll()
        {
            IFundRepository fundsRepository = new FundRepository();
            MainForm        mockView        = new MainForm(fundsRepository);
            IPresenter      presenter       = mockView.Presenter;

            foreach (var r in mockView.Funds)
            {
                NUnit.Framework.Assert.IsNotNull(r);
            }
        }
예제 #13
0
        public async Task <IResult <FundRepository> > FindAsync(FundRepository fundRepository)
        {
            ProxyXFMFund.FundRepositoryInput input = new ProxyXFMFund.FundRepositoryInput
            {
                FundRepository = AutoMapper.Mapper.Map <ProxyXFMFund.FundRepository>(fundRepository),

                InputContext = this.UpdateContext <ProxyXFMFund.Context>()
            };
            var result = await InvokeMethodAsync <Domain.FundRepository, ProxyXFMFund.WSFundClient>("Find", input);

            return(result);
        }
        private void Save(object obj)
        {
            fund.Validate();

            if (fund.HasErrors)
            {
                MessageBox.Show("Fund Errors");
            }
            else
            {
                using (FundRepository fac = new FundRepository())
                {
                    fac.Save <FundConcept>(fund);
                }
            }
        }
예제 #15
0
 public IResult <FundRepository> Find(FundRepository fundRepository)
 {
     throw new NotImplementedException();
 }