コード例 #1
0
        public void SetUp()
        {
            _mocker = new AutoMoqer();

            _employee = new Employee()
            {
                Id = Id,
                Name = Name
            };

            _mocker.GetMock<IDbSet<Employee>>()
                .SetUpDbSet(new List<Employee> { _employee });

            _mocker.GetMock<IDatabaseContext>()
                .Setup(p => p.Employees)
                .Returns(_mocker.GetMock<IDbSet<Employee>>().Object);

            _query = _mocker.Create<GetEmployeesListQuery>();
        }
コード例 #2
0
        public void SetUp()
        {
            _mocker = new AutoMoqer();

            _employee = new Employee()
            {
                Id   = Id,
                Name = Name
            };

            _mocker.GetMock <IDbSet <Employee> >()
            .SetUpDbSet(new List <Employee> {
                _employee
            });

            _mocker.GetMock <IDatabaseService>()
            .Setup(p => p.Employees)
            .Returns(_mocker.GetMock <IDbSet <Employee> >().Object);

            _query = _mocker.Create <GetEmployeesListQuery>();
        }
コード例 #3
0
        public void SetUp()
        {
            _mocker = new AutoMoqer();

            _employee = new Employee()
            {
                Id   = Id,
                Name = Name
            };

            _employees = new List <Employee>()
            {
                _employee
            };

            _mocker.GetMock <IEmployeeRepository>()
            .Setup(p => p.GetAll())
            .Returns(_employees.AsQueryable());

            _query = _mocker.Create <GetEmployeesListQuery>();
        }