示例#1
0
        public void ShouldCreateNew()
        {
            using (var tradingBookService = new TradingBookService(new AmfMoneyContext(_options)))
            {
                TradingBook expected = GenerateTradingBook();

                TradingBook actual = tradingBookService.Create(expected);

                Assert.True(actual.Id > 0);
                Assert.Equal(0.20, actual.AmountPerCaptal);
                Assert.Equal(expected.Name, actual.Name);
                Assert.Equal(expected.RiskRewardRatio, actual.RiskRewardRatio);
                Assert.NotEqual(default, actual.CreatedAt);
        public void ShouldCreateNew()
        {
            AccountEntity account = GenerateAccount();

            using (var context = new AmfMoneyContext(_options))
            {
                context.Accounts.Add(account);
                context.SaveChanges();
            }

            using (var tradingBookService = new TradingBookService(new AmfMoneyContext(_options)))
            {
                TradingBookSetting setting = GenerateSetting();

                TradingBookEntity actual = tradingBookService.Create(account.Id, setting);

                Assert.True(actual.Id > 0);
                Assert.Equal(setting, actual.Setting);
                Assert.NotEqual(default, actual.CreatedAt);