示例#1
0
        public void create_dependent_handler_should_return_null_for_missing_employee()
        {
            using (var context = new ApiDbContext(_options))
            {
                var handler = new CreateDependentHandler(context);
                var request = new CreateDependentRequest
                {
                    FirstName  = "First",
                    LastName   = "Last",
                    EmployeeId = 999
                };
                var actual = handler.Handle(request, default(CancellationToken)).Result;

                actual.Should().BeNull();
            }
        }
示例#2
0
        public void create_dependent_handler_should_return_new_create_dependent_response()
        {
            using (var context = new ApiDbContext(_options))
            {
                var handler  = new CreateDependentHandler(context);
                var employee = CreateEmployeeResponse(context);
                var request  = new CreateDependentRequest
                {
                    FirstName  = "First",
                    LastName   = "Last",
                    EmployeeId = employee.Id
                };
                var actual = handler.Handle(request, default(CancellationToken)).Result;

                var expected = new CreateDependentResponse
                {
                    Employee = new EmployeeResponse
                    {
                        Id                      = employee.Id,
                        FirstName               = "First",
                        LastName                = "Last",
                        PersonalBenefitsCost    = "$1,000.00",
                        AnnualBenefitsCost      = "$1,500.00",
                        BenefitsCostPerPaycheck = "$57.69"
                    },
                    Dependent = new DependentResponse
                    {
                        EmployeeId           = employee.Id,
                        FirstName            = "First",
                        LastName             = "Last",
                        PersonalBenefitsCost = "$500.00"
                    }
                };
                actual.Should().BeEquivalentTo(expected);
            }
        }