public void SetUp()
 {
     _autoSubstitute = AutoSubstituteContainer.Create();
     _controller = _autoSubstitute.GetController<DataDepositController>();
     _confirmController = _autoSubstitute.GetController<ConfirmController>();
     _projectController = _autoSubstitute.GetController<ProjectController>();
     _context = _autoSubstitute.Resolve<ControllerContext>();
     _lookup = _autoSubstitute.Resolve<ICurtinUserService>();
     _projectRepository = _autoSubstitute.Resolve<IProjectRepository>();
 }
        public void SetUp()
        {
            _autoSubstitute = AutoSubstituteContainer.Create();

            _projectRepository = _autoSubstitute.Resolve<IProjectRepository>();
            _dataCollectionRepository = _autoSubstitute.Resolve<IDataCollectionRepository>();
            _controller = _autoSubstitute.GetController<ConfirmController>();
            _lookup = _autoSubstitute.Resolve<ICurtinUserService>();
            var user = CreateUser("XX12345");
            var dmp = Builder<DataManagementPlan>.CreateNew()
                .With(o => o.NewDataDetail = Builder<NewDataDetail>.CreateNew().Build())
                .And(o => o.ExistingDataDetail = Builder<ExistingDataDetail>.CreateNew().Build())
                .And(o => o.DataSharing = Builder<DataSharing>.CreateNew().Build())
                .And(o => o.DataRelationshipDetail = Builder<DataRelationshipDetail>.CreateNew().Build())
                .Build();
            var dd = Builder<DataDeposit>.CreateNew().Build();
            _project = Builder<Project>.CreateNew()
                .With(o => o.DataManagementPlan = dmp)
                .And(o => o.DataDeposit = dd)
                .And(p => p.Description = "TestProject")
                .And(o => o.Keywords = "1,2,3,4,5,6,7,8,9,10,11,12")
                .Build();
            _project.FieldsOfResearch.AddRange(Builder<ProjectFieldOfResearch>
                                                   .CreateListOfSize(5)
                                                   .All()
                                                   .With(p => p.FieldOfResearch = Builder<FieldOfResearch>.CreateNew().Build())
                                                   .Build());
            _project.SocioEconomicObjectives.AddRange(Builder<ProjectSocioEconomicObjective>
                                                          .CreateListOfSize(7)
                                                          .All()
                                                          .With(p => p.SocioEconomicObjective = Builder<SocioEconomicObjective>.CreateNew().Build())
                                                          .Build());
            _project.Parties.AddRange(Builder<ProjectParty>.CreateListOfSize(8)
                                          .TheFirst(1)
                                          .With(o => o.Role = AccessRole.Members)
                                          .And(o => o.Party = Builder<Party>.CreateNew().With(p => p.Id = 0).Build())
                                          .TheNext(1)
                                          .With(o => o.Role = AccessRole.Owners)
                                          .And(o => o.Party = Builder<Party>.CreateNew().With(p => p.Id = 0).And(p => p.UserId = user.CurtinId).Build())
                                          .And(o => o.Relationship = ProjectRelationship.PrincipalInvestigator)
                                          .TheNext(1)
                                          .With(o => o.Role = AccessRole.Visitors)
                                          .And(o => o.Party = Builder<Party>.CreateNew().With(p => p.Id = 0).Build())
                                          .TheNext(1)
                                          .With(o => o.Role = AccessRole.None)
                                          .And(o => o.Party = Builder<Party>.CreateNew().With(p => p.Id = 0).Build())
                                          .TheNext(1)
                                          .With(o => o.Role = AccessRole.Members)
                                          .And(
                                              o =>
                                              o.Party =
                                              Builder<Party>.CreateNew().With(p => p.UserId = "FF24587").Build())
                                          .TheNext(1)
                                          .With(o => o.Role = AccessRole.Visitors)
                                          .And(
                                              o =>
                                              o.Party =
                                              Builder<Party>.CreateNew().With(p => p.UserId = "GA37493").Build())
                                          .TheNext(1)
                                          .With(o => o.Role = AccessRole.None)
                                          .And(
                                              o =>
                                              o.Party =
                                              Builder<Party>.CreateNew().With(p => p.UserId = "KK25344").Build())
                                          .TheNext(1)
                                          .With(o => o.Role = AccessRole.Owners)
                                          .And(
                                              o =>
                                              o.Party =
                                              Builder<Party>.CreateNew().With(p => p.UserId = "DD25265").Build())
                                          .Build());

            _bus = _autoSubstitute.Resolve<IBus>();
            _projectRepository.Get(Arg.Is(_project.Id)).Returns(_project);
            _projectRepository.GetByDataManagementPlanId(Arg.Is(_project.DataManagementPlan.Id)).Returns(_project);

            var resolver = Substitute.For<IDependencyResolver>();
            DependencyResolver.SetResolver(resolver);
        }