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

Add ToString and comparison operators to ByteRate with tests #803

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

Cirzen
Copy link

@Cirzen Cirzen commented Mar 26, 2019

Fixes #802

Here is a checklist you should tick through before submitting a pull request:

  • Implementation is clean
  • Code adheres to the existing coding standards; e.g. no curlies for one-line blocks, no redundant empty lines between methods or code blocks, spaces rather than tabs, etc.
  • No ReSharper warnings
  • There is proper unit test coverage
  • If the code is copied from StackOverflow (or a blog or OSS) full disclosure is included. That includes required license files and/or file headers explaining where the code came from with proper attribution
  • There are very few or no comments (because comments shouldn't be needed if you write clean code)
  • Xml documentation is added/updated for the addition/change
  • Your PR is (re)based on top of the latest commits from the dev branch (more info below)
  • Link to the issue(s) you're fixing from your PR description. Use fixes #<the issue number>
  • Readme is updated if you change an existing feature or add a new one
  • Run either build.cmd or build.ps1 and ensure there are no test failures

@dnfclas
Copy link

dnfclas commented Mar 26, 2019

CLA assistant check
All CLA requirements met.

@Cirzen
Copy link
Author

Cirzen commented Mar 26, 2019

Looks like my typo correction has caused one of the tests to fail. I'll revert that change.

@Cirzen
Copy link
Author

Cirzen commented Mar 28, 2019

Failing on the approve_public_api test, since that's what I've changed.
Was

    public class ByteRate
    {
        public ByteRate(Humanizer.Bytes.ByteSize size, System.TimeSpan interval) { }
        public System.TimeSpan Interval { get; }
        public Humanizer.Bytes.ByteSize Size { get; }
        public string Humanize(Humanizer.Localisation.TimeUnit timeUnit = 1) { }
        public string Humanize(string format, Humanizer.Localisation.TimeUnit timeUnit = 1) { }
    }

Now

    public class ByteRate : System.IComparable, System.IComparable<Humanizer.Bytes.ByteRate>, System.IEquatable<Humanizer.Bytes.ByteRate>
    {
        public ByteRate(Humanizer.Bytes.ByteSize size, System.TimeSpan interval) { }
        public System.TimeSpan Interval { get; }
        public Humanizer.Bytes.ByteSize Size { get; }
        public int CompareTo(Humanizer.Bytes.ByteRate other) { }
        public int CompareTo(object obj) { }
        public bool Equals(Humanizer.Bytes.ByteRate other) { }
        public string Humanize(Humanizer.Localisation.TimeUnit timeUnit = 1) { }
        public string Humanize(string format, Humanizer.Localisation.TimeUnit timeUnit = 1) { }
        public override string ToString() { }
        public string ToString(string format, Humanizer.Localisation.TimeUnit timeUnit = 1) { }
    }

Could do with some feedback or guidance on best way to proceed here.

@AKTheKnight
Copy link
Contributor

If you run either build.cmd or build.ps1 it should come up with a method of updating the PublicApiApprovalTest.approve_public_api.approved.txt file.

Once that matches the public api, the test will then pass

@Cirzen
Copy link
Author

Cirzen commented Oct 3, 2020

Hi Claire, would you be willing to have another look at this, I've hopefully resolved any remaining concerns.

@clairernovotny
Copy link
Member

Looks like there's a build error that needs to be resolved?

@Cirzen
Copy link
Author

Cirzen commented Oct 4, 2020

You're right, I jumped the gun. Looks like some issues in Master

@Cirzen
Copy link
Author

Cirzen commented Nov 5, 2020

Now passing tests

@SimonCropp
Copy link
Collaborator

@Cirzen sorry for the delay. can you rebase and re-approve the api changes

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.

ByteRate has no ToString or comparison methods.
5 participants