public void GetBenchmark_InvalidInput_ReturnBadRequest()
        {
            Mock <IBenchmarkRepo> mock = new Mock <IBenchmarkRepo>();

            mock.Setup(p => p.GetNolist()).Returns(l2);
            BenchmarkRepo         cp     = new BenchmarkRepo();
            List <AuditBenchmark> result = cp.GetNolist();

            Assert.AreNotEqual(l1.Count, result.Count);
        }
        public void Test1()
        {
            BenchmarkRepo obj1 = new BenchmarkRepo();

            BenchmarkProvider bp = new BenchmarkProvider(obj1);

            AuditBenchmarkController obj = new AuditBenchmarkController(bp);

            var data = obj.Get() as OkObjectResult;

            Assert.AreEqual(200, data.StatusCode);
        }
示例#3
0
        public void Init()
        {
            // setup, create sample benchmark index  repo
            fm = new FundManager();
            var indexName = "UK Corporate Benchmark";

            benchmarkRepo = new BenchmarkRepo();

            benchmarkRepo.Add(new Benchmark()
            {
                IndexWeight = 50, Name = indexName, Stock = new Stock()
                {
                    Symbol = "UNDE"
                }
            });
            benchmarkRepo.Add(new Benchmark()
            {
                IndexWeight = 25, Name = indexName, Stock = new Stock()
                {
                    Symbol = "ROBO"
                }
            });
            benchmarkRepo.Add(new Benchmark()
            {
                IndexWeight = 10, Name = indexName, Stock = new Stock()
                {
                    Symbol = "ABAC"
                }
            });
            benchmarkRepo.Add(new Benchmark()
            {
                IndexWeight = 10, Name = indexName, Stock = new Stock()
                {
                    Symbol = "DODO"
                }
            });
            benchmarkRepo.Add(new Benchmark()
            {
                IndexWeight = 5, Name = indexName, Stock = new Stock()
                {
                    Symbol = "ZIZA"
                }
            });

            // create a mock fund
            var fund = fm.CreateFund("UK Equity Tracker", new FundRepo(), benchmarkRepo);

            // add cash tot the fund
            fund.AddCash(50023.00M);
            // add some stock to the newly created fund
            fund.AddCash(50023.00M);
            fund.AddStock(new Stock()
            {
                Symbol = "ROBO"
            }, qty: 100, price: 8.22M);
            fund.AddStock(new Stock()
            {
                Symbol = "UNDE"
            }, qty: 500, price: 3.11M);
            fund.AddStock(new Stock()
            {
                Symbol = "ABAC"
            }, qty: 600, price: .39M);
            fund.AddStock(new Stock()
            {
                Symbol = "DODO"
            }, qty: 30, price: 12M);
            fund.AddStock(new Stock()
            {
                Symbol = "XYZ"
            }, qty: 100, price: 10M);
        }
        public IEnumerable <AuditBenchmark> Get()
        {
            BenchmarkRepo obj = new BenchmarkRepo();

            return(obj.GetNolist());
        }