Пример #1
0
        /// <summary>
        /// Gets required data from order
        /// </summary>
        /// <returns>Data for order</returns>
        public (int, DateTime, Type) GetDataForOrder()
        {
            int id = MockBucketOrderRepository.GetLastId() + 1;

            DateTime date       = DateTime.Now;
            var      returnType = MockActiveUserRepository.WhoISLogged();

            return(id, date, returnType);
        }
Пример #2
0
        public void GetDataForOrder_ReturnsCorrectData()
        {
            var result = newOrderBLL.GetDataForOrder();
            var id     = MockBucketOrderRepository.GetLastId() + 1;
            var date   = DateTime.Today;
            var user   = MockActiveUserRepository.CurrentUser;

            Assert.AreEqual(result.Item1, id);
            Assert.AreEqual(result.Item2.Date, date);
            Assert.AreEqual(user.GetType(), result.Item3);
        }
Пример #3
0
        /// <summary>
        /// Get last id from bucket orders
        /// </summary>
        /// <returns>int value of id</returns>
        /// <exception cref="NullReferenceException">Returns if id not in range</exception>
        public int GetLastId()
        {
            NullReferenceException ex = new NullReferenceException("Orders");



            int lastId = MockBucketOrderRepository.GetLastId();

            if (lastId == 0)
            {
                throw ex;
            }

            if (MockOrderHistoryRepository.GetLastId() >= lastId)
            {
                return(MockOrderHistoryRepository.GetLastId());
            }
            else
            {
                return(lastId);
            }
        }