Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
DKarzhounikGDT opened this issue Sep 1, 2021 · 3 comments

Comments

@DKarzhounikGDT
Copy link

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

@DKarzhounikGDT DKarzhounikGDT changed the title MAKE IT USABLE it is hard to use and support because of incomprehensive code make it usable it is hard to use and support because of incomprehensive code Sep 17, 2021
@DKarzhounikGDT
Copy link
Author

DKarzhounikGDT commented Sep 17, 2021

.HasPerformed<AddEmployee, ValueWrapper>(

  • gives to much noise. smthing like
    .HasPerformed((x) => ..{}) might look better

or smthing like in autofixture fluent builder ...

@DKarzhounikGDT
Copy link
Author

more samples:
gitlab link

@DKarzhounikGDT
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant