-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
DESCRIPTION
[Test]
public void Create_When_HealthCheckIdIsNotNull_Returns_Created()
{
var healthCheck = new HealthCheckCreateViewModel
{
Title = "Test HealthCheck for HealthCheckSummary (create)",
Project = new ProjectId { Id = 1 },
Survey = new SurveyId { Id = 1 }
};
var healthCheckSetupViewModel = new Fixture().Create<HealthCheckSetupViewModel>();
var interviewer = new Fixture()
.Build<ParticipantCreateViewModel>()
.With(x => x.Employee, 2)
.With(x => x.IsInterviewer, true)
.Create();
var participantModel = new ParticipantsCreateViewModel { Items = new[] { interviewer } };
Scenario.New()
.Given()
.HasPerformed<CreateHealthCheck>(x => x.Model = healthCheck)
.HasPerformed<SetupHealthCheck, ValueWrapper<long>>(
(x, id) =>
{
x.HealthCheckId = id.Value;
x.Model = healthCheckSetupViewModel;
})
.HasPerformed<LaunchHealthCheck, ValueWrapper<long>>(
(x, id) =>
{
x.HealthCheckId = id.Value;
x.SendNotifications = true;
})
.HasPerformed<AddEmployee, ValueWrapper<long>>(
(x, id) =>
{
x.HealthCheckId = id.Value;
x.Model = participantModel;
})
.HasPerformed<GetInterviewers, ValueWrapper<long>>(
(x, id) => x.HealthCheckId = id.Value)
.HasPerformed<CompleteHealthCheck, ValueWrapper<long>, ValueWrapper<IEnumerable<ParticipantViewModel>>> (
(x, id, model) =>
{
x.HealthCheckId = id.Value;
x.InterviewerId = model.Value.First().UniqueId;
}
)
.When()
.Performs<HttpRequest, ValueWrapper<long>>(
(request, id) => request
.Method(WebRequestMethods.Http.Post)
.Url(string.Format(_url, id.Value)))
.Then()
.Expects<HttpResponse, ValueWrapper<long>>(
(r, b) => r.Status(HttpStatusCode.Created))
.Run();
}
ADDITIONAL CONTEXT
any advice who to make it more understandable ???
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels