Skip to content

make it usable it is hard to use and support because of incomprehensive code #4

@DKarzhounikGDT

Description

@DKarzhounikGDT

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 ???

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions