Skip to content

Add Two Bucket Test Generator #447

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

Merged
merged 7 commits into from
Oct 2, 2017
Merged

Conversation

GKotfis
Copy link
Contributor

@GKotfis GKotfis commented Sep 30, 2017

I've mixed feelings about what I've done but maybe it's ok ;)

  1. SetConstructorInputParameters() is this hardcoded properties array is ok?
  2. RenderTestMethodBodyAssert. I tried to do this by using some for loops by Expected values (to avoid this hardcoded property) but without any good result.
    Please feel free to give some advice in case something needs change.

Copy link
Member

@ErikSchierboom ErikSchierboom left a comment

Choose a reason for hiding this comment

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

I must say I'm really impressed with how you handled this! The only comments I have are on naming and a small simplification, but the general approach is spot on! 👍

@@ -9,18 +9,18 @@ public enum Bucket
public class TwoBucketResult
{
public int Moves { get; set; }
public Bucket GoalBucket { get; set; }
public int OtherBucketContents { get; set; }
public Bucket Goal_bucket { get; set; }
Copy link
Member

Choose a reason for hiding this comment

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

Please rename this to GoalBucket, to conform to standard .NET naming guidelines.

public Bucket GoalBucket { get; set; }
public int OtherBucketContents { get; set; }
public Bucket Goal_bucket { get; set; }
public int Other_bucket { get; set; }
Copy link
Member

Choose a reason for hiding this comment

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

Please rename this to OtherBucket, to conform to standard .NET naming guidelines.

{
public TwoBuckets(int bucketOneSize, int bucketTwoSize, Bucket startBucket)
public TwoBucket(int bucket_one, int bucket_two, Bucket start_bucket)
Copy link
Member

Choose a reason for hiding this comment

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

Could you rename the parameters to bucketOne, bucketTwo and startBucket?

foreach (var canonicalDataCase in canonicalData.Cases)
{
canonicalDataCase.TestedMethodType = TestedMethodType.Instance;
canonicalDataCase.SetConstructorInputParameters(new [] { "bucket_one", "bucket_two", "start_bucket"});
Copy link
Member

Choose a reason for hiding this comment

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

The SetConstructorInputParameters take a param string[], which means you can simplify this to: SetConstructorInputParameters("bucket_one", "bucket_two", "start_bucket")

@GKotfis
Copy link
Contributor Author

GKotfis commented Oct 1, 2017

I was aware of breaking .net coding guidelines here. Wanted match canonical data properties with variables names. But I'll simply replace them in update canonical data method. Stay tuned 😉

@ErikSchierboom
Copy link
Member

Great! Let me say once again that I'm impressed with the quality of your PR!

- Simplify SetConstructorInputParameters params
Copy link
Member

@ErikSchierboom ErikSchierboom left a comment

Choose a reason for hiding this comment

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

I'll just wait for the CI to become green, and then I'll merge. Thanks a lot!

@GKotfis
Copy link
Contributor Author

GKotfis commented Oct 1, 2017

Thanks for the compliment! I think I'll grab another issue :)

@jpreese
Copy link
Contributor

jpreese commented Oct 2, 2017

Yeah, this looks great @GKotfis! Just as a heads up, since you changed the name of the class, you'll also need to update the Example.cs file so that it matches.

}

public class TwoBuckets
public class TwoBucket
Copy link
Contributor

Choose a reason for hiding this comment

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

Example.cs should be changed as well.

@ErikSchierboom
Copy link
Member

Everything's green, so I'll merge it. Thanks a lot! 🎉

@ErikSchierboom ErikSchierboom merged commit 4aee316 into exercism:master Oct 2, 2017
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.

3 participants