Beispiel #1
0
        public void TestGetOrdersByUserId(int userId)
        {
            // arrange
            _dbContext      = _dbContext ?? Configurations.GetDbContext();
            _mapperProvider = _mapperProvider ?? Configurations.GetMapperProvider();
            _mapper         = _mapper ?? Configurations.GetMapper();

            // act
            var result = new OrderRepo(_dbContext, _mapperProvider, _mapper).GetOrdersByUserId(userId).ToList();

            // assert
            if (result.Any())
            {
                Assert.All(result, order =>
                {
                    Assert.True(order.OrderId > 0);
                    Assert.IsType <Guid>(order.CustomerOrderId);
                    Assert.False(string.IsNullOrEmpty(order.City));
                    Assert.True(order.TotalValue > 0);
                    Assert.False(string.IsNullOrEmpty(order.CreatedDateTime));
                });
            }
        }