public void Equals_OtherHasSameFileAndId_ReturnsTrue() { const string fileName1 = @"c:\xyz\abc"; const string fileName2 = @"c:\xyz\abc"; const int id1 = 24680; const int id2 = 24680; using (ShimsContext.Create()) { ShimFile.ExistsString = (f) => { return((f == fileName1 || f == fileName2) ? true : ShimsContext.ExecuteWithoutShims(() => File.Exists(f))); }; A11yElement element1 = new ShimA11yElement { UniqueIdGet = () => id1, }; A11yElement element2 = new ShimA11yElement { UniqueIdGet = () => id2, }; ILocation location1 = new OutputFileLocation(fileName1, element1); ILocation location2 = new OutputFileLocation(fileName2, element2); Assert.IsTrue(location1.Equals(location2)); Assert.IsTrue(location2.Equals(location1)); } }
public void Equals_OtherIsDifferentClass_ReturnsFalse() { const string fileName = @"c:\xyz\abc"; using (ShimsContext.Create()) { ShimFile.ExistsString = (f) => { return(f == fileName ? true : ShimsContext.ExecuteWithoutShims(() => File.Exists(f))); }; A11yElement element = new ShimA11yElement { UniqueIdGet = () => 24680, }; ILocation location = new OutputFileLocation(fileName, element); Assert.IsFalse(location.Equals(new StubILocation())); } }