コード例 #1
0
 public EvaluationControllerTests()
 {
     _mediator   = A.Fake <IMediator>();
     _controller = new EvaluationsController(_mediator);
 }
コード例 #2
0
        public void Setup()
        {
            cohort = new Cohort()
            {
                CohortID      = 0,
                Name          = "Test",
                Type1Assigned = false,
                Type2Assigned = false
            };

            employee = new Employee
            {
                EmployeeID = 0,
                FirstName  = "Dwight",
                LastName   = "Schrute",
                Email      = "*****@*****.**",
                CohortID   = 0,
                Cohort     = cohort
            };

            stages = new List <Stage>
            {
                new Stage
                {
                    StageID   = 0,
                    StageName = "Baseline",
                    Evals     = new List <Evaluation>()
                },
                new Stage
                {
                    StageID   = 1,
                    StageName = "Formative",
                    Evals     = new List <Evaluation>()
                },
                new Stage
                {
                    StageID   = 2,
                    StageName = "Summative",
                    Evals     = new List <Evaluation>()
                }
            };

            types = new List <CapstoneProject.Models.Type>
            {
                new CapstoneProject.Models.Type
                {
                    TypeID     = 0,
                    TypeName   = "Type 1",
                    Categories = new List <Category>(),
                    Evals      = new List <Evaluation>()
                },
                new CapstoneProject.Models.Type
                {
                    TypeID     = 1,
                    TypeName   = "Type 2",
                    Categories = new List <Category>(),
                    Evals      = new List <Evaluation>()
                },
            };

            evals = new List <Evaluation>
            {
                new Evaluation
                {
                    EvaluationID  = 0,
                    EmployeeID    = 0,
                    Employee      = employee,
                    OpenDate      = DateTime.Today.AddDays(-10),
                    CloseDate     = DateTime.Today.AddDays(10),
                    SelfAnswers   = "123123",
                    CompletedDate = DateTime.Today.AddDays(-10),
                    Raters        = new List <Rater>(),
                },
                new Evaluation
                {
                    EvaluationID  = 1,
                    EmployeeID    = 0,
                    Employee      = employee,
                    OpenDate      = DateTime.Today.AddDays(-10),
                    CloseDate     = DateTime.Today.AddDays(10),
                    SelfAnswers   = null,
                    CompletedDate = null,
                    Raters        = new List <Rater>(),
                }
            };

            mockUnitOfWork        = new Mock <IUnitOfWork>();
            controller            = new EvaluationsController();
            controller.UnitOfWork = mockUnitOfWork.Object;
            mockUnitOfWork.Setup(
                m => m.EvaluationRepository.Get(null, null, "")).Returns(
                evals);
            foreach (var eval in evals)
            {
                mockUnitOfWork.Object.EvaluationRepository.Insert(eval);
            }
        }