示例#1
0
        public void AddDeal_CorrectDeal_AreEqualData()
        {
            //Arrange
            var seller = new Trader()
            {
                Name        = "NameSeller",
                Surname     = "SurnameSeller",
                PhoneNumber = "phoneNumberSeller",
                Balance     = 0,
            };

            var share = new Share()
            {
                Name  = "TestSare",
                Owner = seller,
                Price = 100
            };

            seller.SharesCollection.Add(share);

            var buyer = new Trader()
            {
                Name        = "NameBuyer",
                Surname     = "SurnameBuyer",
                PhoneNumber = "phoneNumberBuyer",
                Balance     = 80,
            };

            //Act
            _businessService.AddDeal(buyer, seller, share);

            //Assert
            Assert.AreEqual(seller.SharesCollection.Contains(share), false);
            Assert.AreEqual(buyer.SharesCollection.Contains(share), true);
            Assert.AreEqual(TraderService.GetZone(seller), Zone.Green);
            Assert.AreEqual(TraderService.GetZone(buyer), Zone.Black);
            Assert.AreEqual(share.Owner, buyer);
            Assert.AreEqual(buyer.Balance, -20);
            Assert.AreEqual(seller.Balance, 100);
        }
示例#2
0
 public IQueryable <Trader> GetOrangeTraders() =>
 _dataContext.Traders.Where(trader => TraderService.GetZone(trader) == Zone.Orange);