public void TestInitialize()
        {
            _mockRepository = new Mock <IOrdersRepository>();
            _mockMapper     = new Mock <IMapper>();
            _mockUnitOfWork = new Mock <IUnitOfWork>();

            _mockQueueStore = new Mock <IQueueStore>();
            _mockUnitOfWork.SetupGet(u => u.Orders).Returns(_mockRepository.Object);
            _mockBookMarkletHelper = new Mock <IBookMarkletHelper>();
            _controller            = new BookMarkletController(_mockUnitOfWork.Object, _mockMapper.Object, _mockQueueStore.Object, _mockBookMarkletHelper.Object);

            _userId   = "1";
            _userName = "******";
            _controller.MockCurrentUserAndRole(_userId, _userName, UserRoles.Consultant);
        }
示例#2
0
        public void SetUp()
        {
            var config = new MapperConfiguration(c => c.AddProfile(new MappingProfile()));

            var mapper = config.CreateMapper();

            _context = new ApplicationDbContext();

            _transferee = _context.Transferees.SingleOrDefault(u => u.Email.Equals("*****@*****.**"));
            if (_transferee == null)
            {
                _transferee = new Transferee()
                {
                    Email = "*****@*****.**", UserName = "******"
                };
                _context.Transferees.Add(_transferee);
                _context.SaveChanges();
                _context.Entry(_transferee).Reload();
            }

            _pm = _context.Managers.First(u => u.UserName.Equals("*****@*****.**"));

            _dsc = _context.Consultants.SingleOrDefault(u => u.Email.Equals("*****@*****.**"));
            if (_dsc == null)
            {
                _dsc = new Consultant()
                {
                    Email = "*****@*****.**", UserName = "******"
                };
                _context.Consultants.Add(_dsc);
                _context.SaveChanges();
                _context.Entry(_dsc).Reload();
            }

            var queueStore = new QueueStore();

            _mockBookMarkletHelper = new Mock <IBookMarkletHelper>();

            _controller = new BookMarkletController(new UnitOfWork(_context), mapper, queueStore, _mockBookMarkletHelper.Object);
        }