예제 #1
0
        public void SetUp()
        {
            DiMvc.Register();
            Ioc.RegisterType<IConfig, FakeConfig>();

            _config = Ioc.Resolve<IConfig>() as FakeConfig;

            _users = new List<User>()
                         {
                             new User { Email = "*****@*****.**", FullName = "aaa ddd", FirstName = "aaa", LastName = "ddd"},
                             new User { Email = "*****@*****.**", FullName = "aaa bbb", FirstName = "aaa", LastName = "bbb"}
                         };

            _repoUnit = new RepoUnit();
            _users.ForEach(_repoUnit.User.Save);

            var userService = new UserService(_repoUnit, null);
            Ioc.RegisterInstance<UserService>(userService);

            var mock = new Mock<ControllerContext>();
            mock.Setup(p => p.HttpContext.Session).Returns(new Mock<HttpSessionStateBase>().Object);

            _usersController = new UsersController(userService) { ControllerContext = mock.Object };

            _config.PageSize = 1;
        }
예제 #2
0
        public void SetupFixture()
        {
            FakeDi.Register();

            _config = Config.Instance as FakeConfig;

            var repoUnit = new RepoUnit();
            Ioc.RegisterInstance<RepoUnit>(repoUnit);

            _rooms.Values.ToList().ForEach(repoUnit.Room.Save);

            _roomService = new RoomService(repoUnit);
            Ioc.RegisterInstance<RoomService>(_roomService);
        }
예제 #3
0
        public void SetUp()
        {
            _users = new List<User>
            {
                new User {Email = "*****@*****.**", FirstName = "Saveli", LastName = "Bondini", Contacts = new Collection<Contact>(), Role = Roles.Simple, Live = LiveStatuses.Active, ApproveState = ApproveStates.Approved},
                new User {Email = "*****@*****.**", FirstName = "Dima", LastName = "Rossi", Contacts = new Collection<Contact>(), Role = Roles.Simple, Live = LiveStatuses.Active, ApproveState = ApproveStates.Approved},
                new User {Email = "*****@*****.**", FirstName = "Dima", LastName = "Prohorov", Contacts = new Collection<Contact>(), Role = Roles.Simple, Live = LiveStatuses.Active, ApproveState = ApproveStates.Approved}
            };

            _repository = Ioc.Resolve<IUserRepository>();
            _repository.Dispose();

            _users.ForEach(_repository.Save);

            _config = Config.Instance as FakeConfig;
            _config.PageSize = _users.Count;
        }
예제 #4
0
        public void Setup()
        {
            FakeDi.Register();

            _repoUnit = new RepoUnit();
            Ioc.RegisterInstance<RepoUnit>(_repoUnit);

            _teams = new List<Team>
            {
                new Team {Name = ".NET", Description = ".NET team"},
                new Team {Name = ".PHP", Description = ".PHP team"},
                new Team {Name = ".C++", Description = ".C++ team"}
            };

            _teams.ForEach(_repoUnit.Team.Save);

            _config = Config.Instance as FakeConfig;
            _config.PageSize = _teams.Count;

            _teamService = new TeamService(_repoUnit);
            Ioc.RegisterInstance<TeamService>(_teamService);
        }
예제 #5
0
        public void SetUpFixture()
        {
            FakeDi.Register();

            _config = Config.Instance as FakeConfig;

            //Create and populate repository instance
            _repository = new RepoUnit();
            Ioc.RegisterInstance<RepoUnit>(_repository);

            _users = new List<User>
            {
                new User {Email = "*****@*****.**", FirstName = "Saveli", LastName = "Bondini", Role = Roles.Simple, ApproveState = ApproveStates.Approved, Live = LiveStatuses.Active},
                new User {Email = "*****@*****.**", FirstName = "Dima", LastName = "Rossi", Role = Roles.Simple, ApproveState = ApproveStates.Approved, Live = LiveStatuses.Active},
                new User {Email = "*****@*****.**", FirstName = "Dima", LastName = "Prohorov", Role = Roles.Simple, ApproveState = ApproveStates.Approved, Live = LiveStatuses.Active},
                new User {Email = "*****@*****.**", FirstName = "Alex", LastName = "Sinov", Role = Roles.Simple, ApproveState = ApproveStates.Approved, Live = LiveStatuses.Active}
            };

            _users.ForEach(_repository.User.Save);

            _userService = new UserService(_repository, Ioc.Resolve<ContactService>());
            Ioc.RegisterInstance<UserService>(_userService);
        }
예제 #6
0
        private void SetUpFixture()
        {
            FakeDi.Register();

            _config = Config.Instance as FakeConfig;
        }