Skip to content

Implemented ShouldRenderFileStream. #30

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 17 commits into from
Sep 4, 2014
Merged

Implemented ShouldRenderFileStream. #30

merged 17 commits into from
Sep 4, 2014

Conversation

AlexArchive
Copy link
Contributor

Please review.

2.0.0
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is my first time practicing Semantic Versioning.

If I understood correctly, a breaking change (see BREAKING_CHANGES.MD) no matter how small should result in the major version being bumped and a major version bump results in the minor and patch versions being reset to 0.

Copy link
Member

Choose a reason for hiding this comment

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

Correct :)

While we are at it let's delete that method we marked [Obsolete] at the same time, also while we are at it can you put the release notes to mention the breaking changes file like I did in Seleno:

Also, we should have a think if there are any other breaking changes we want to make so they can all be made at once.

Also, having a readme.txt file in the root package will pop it open - we can include mention of the breaking changes file and other files like I've done in ChameleonForms:

Let me know if this doesn't make sense and I'll try and explain better :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

While we are at it let's delete that method we marked [Obsolete] at the same time

That is some good thinking man.

Also, having a readme.txt file in the root package will pop it open - we can include mention of the breaking changes file and other files like I've done in ChameleonForms:

So I added a readme.txt to the package root but I have some questions:

  • Should I link the readme.txt between both projects?
  • Could you please direct me on the exact path to use in the NuSpec? Looks like <file src="readme.txt" target="" /> is correct but I am not sure.

Copy link
Member

Choose a reason for hiding this comment

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

I'd link it between the projects yeah, let me know when it's pushed and I'll check it.

Pretty sure what you have above is right. You can download nuget.exe and run nuget pack on the nuspec to check it (make sure you've done a release build), just open up the .nupkg file it generates in your zip viewer of choice (I use 7zip) and check readme.txt is in the root of the package..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the tip.

I think I confirmed that the aforementioned path: <file src="readme.txt" target="" /> works, but only for the normal project.

In hindsight that path clearly won't work for the Mvc3 project because linked files are not copied to the physical directory.

We could use MSBuild to change that I guess?

Copy link
Member

Choose a reason for hiding this comment

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

Try <file src="../FluentMvcTesting/readme.txt" target="" />

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is not quite correct but I think I got it.

Check out the latest push, I think are good now.

Let me know.

Copy link
Member

Choose a reason for hiding this comment

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

Yep looks good!

using (var memoryStream = new MemoryStream())
{
stream.CopyTo(memoryStream);
stream.Position = 0;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As I write this comment I realize that the code needs a comment too (and a unit test..)

As you can see this code resets the stream position.

In reality I did this in response to test pollution (see my other comments) but in practice I also think it makes sense for the test methods not to have any externally visible side effects.

Copy link
Member

Choose a reason for hiding this comment

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

My preference would be to not set position to 0 - if their code doesn't do that then it will fail when executed as well unless I'm misunderstanding?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I suspect this (my code) to be a good idea because we are going to be operating on the result of an operation.

The action method could very well return a stream whose position is zero (and therefore valid at execution time) but as soon as the developer calls into our library, the position of the stream might change and cause subsequent tests to behave unexpectedly.

Responding to both this comment and your comment about test pollution: Just comment the relevant line (stream.Position = 0) and you will see what happens. I want to know your thoughts anyway.

Copy link
Member

Choose a reason for hiding this comment

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

Oh sorry - I misread and thought you were resetting the position before copying the stream. Awesome. This is fine then.

@robdmoore
Copy link
Member

This looks great. Good work mate :)

@AlexArchive
Copy link
Contributor Author

This pull request has got a bit out of hand in my opinion :c - allow me to restore some order with a check off list:

  • Implemented the ShouldRenderFileStream method.
  • Removed the previously obsolete ShouldRenderFile method.
  • Updated the VS solution to reflect file system changes as discussed here.
  • Added a readme.txt to both package directories (mimicking what you did in Seleno).
  • Changed version number to 2.0.0 in NewVersion.txt.
  • Updated each project's respective nuspec file to include the readme.txt file.
  • Documented breaking changes in BREAKING_CHANGES.MD.
    • If you are happy with the wording etc. then I can check this box.
  • Update each project's respective nuspec to include release notes (as in <releaseNotes>).
    • Should I use the same format as Seleno exactly? If so - is it possible to make the version number work with NewVersion.txt as to avoid duplication?

If you can confirm the two latter points then I think this will be good to merge and then deploy. I will write some documentation for the website shortly after this branch has been merged.

@AlexArchive AlexArchive changed the title Implemented ShouldRenderFile Implemented ShouldRenderFileStream. Sep 2, 2014
@robdmoore
Copy link
Member

Nice! Love the checklist.

re: releaseNotes I'd make it:

For breaking changes from previous versions see https://github.com/TestStack/TestStack.FluentMVCTesting/blob/master/BREAKING_CHANGES.md


### Reason

The `ShouldRenderFile` method was equivocal because it had the possibility to be interperted to test for a `FileResult` when in fact, it tested for a `FileContentResult`.
Copy link
Member

Choose a reason for hiding this comment

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

Minor: I'd make "equivocal" "ambiguous" so it's understandable to more people.

@robdmoore
Copy link
Member

:shipit:

btw - sometime after this PR I think it's worth going through and reorganising the source files a bit. they are all too big. I have some ideas. Worth discussing some time :)

@AlexArchive
Copy link
Contributor Author

I am really glad that you brought that up, I looking forward to discussing your our ideas some time.

Are we good to merge now do you think?

@robdmoore
Copy link
Member

Yep - great work!

robdmoore added a commit that referenced this pull request Sep 4, 2014
Implemented ShouldRenderFileStream.
@robdmoore robdmoore merged commit 206c5d9 into TestStack:master Sep 4, 2014
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