History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: RSRP-57046
Type: Bug Bug
Status: Open Open
Priority: Normal Normal
Assignee: Ilya Ryzhenkov
Reporter: Andrew Serebryansky
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
ReSharper

'Generate' makes incorrect Equals and GetHashCode

Created: 31 Jan 08 21:00   Updated: 13 Mar 08 22:38
Component/s: Generate Action
Fix Version/s: 4.0
Security Level: Everybody (All jira users)

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown

Build: 584


 Description  « Hide
Insert (alt + ins) Equals and Hash Code yields invalid code.
[TestFixture]
public class DateTests
{
[Test]
public void DatesAreEqual()
{
Assert.That(new Date(DateTime.Today), Is.EqualTo(new Date(DateTime.Today)));
}

internal class Date
{
private readonly DateTime date;

public Date(DateTime date)
{
this.date = date.Date;
}

protected bool Equals(Date date)
{
if (date == null) return false;
return Equals(date, date.date);
}

public override bool Equals(object obj)
{
if (ReferenceEquals(this, obj)) return true;
return Equals(obj as Date);
}

public override int GetHashCode()
{
return date.GetHashCode();
}
}

}


 All   Comments   Work Log   Change History      Sort Order:
There are no comments yet on this issue.