Skip to content

Conversation

@WiseLordship
Copy link

@WiseLordship WiseLordship commented Jul 6, 2017

Issue details

Implementation for getting projects based on lambda expressions.

Relates to issue

#102

Checklist

  • All unit tests passed on build server
  • Acceptance test(s) covers new/modified functionality
  • Code coverage is at least the same or higher
  • Breaking change in public API

Example of using new/modified functionality

  var project = new RemoteTc(c=>c.ToHost("HOST").AsGuest())
     .GetProject(project => project.Id("FluentTc") );

  var project = new RemoteTc(c=>c.ToHost("HOST").AsGuest())
     .GetProject(project => project.Name("FluentTc") );

Copy link
Contributor

@borismod borismod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@WiseLordship thanks a lot for your contribution. I'll appreciate if you could take a loot on my questions.

A.CallTo(() => teamCityCaller.Get<Project>(expectedCall)).MustHaveHappened();
}

private static TeamCityCaller CreateTeamCityCaller()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not reusing CreateTeamCityCaller from AcceptanceTests?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I started with that and realized I was not mocking it the right way. So moved that out and new tests should be following the mocking correctly.

}

public Project GetProject(string projectId)
public Project GetProject(Action<IBuildProjectHavingBuilder> having = null)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why having is nullable? What is the expected result when we call GetProject() ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, I was not fully looking at it correctly. I added the logic to make sure we are only returning one and made it similar to GetAgent().

[TestCase("FluentTC")]
[TestCase("Test 1")]
[TestCase("Test%20C")]
public void GetProject_ByName(string projectName)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this test covers URL encoding?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was actually just testing random characters and thought that would be the most common that someone would enter. Currently, not handling URL encoding.

namespace FluentTc.Tests
{
[TestFixture]
public class ProjectRetrievalTests
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are acceptance tests and they should reside inside AcceptanceTests

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will move these to AcceptanceTests and will make better overall tests for the method. I started here when I was trying t make more robust tests, and did not move these out.

@borismod
Copy link
Contributor

@WiseLordship what is the status of this PR?

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

Successfully merging this pull request may close these issues.

2 participants