public void CppCheckLocation_CanBeConvertedToSarifIssue() { PhysicalLocation result = new CppCheckLocation("foo.cpp", 42).ToSarifPhysicalLocation(); Assert.IsTrue( result.ValueEquals( new PhysicalLocation { Uri = new Uri("foo.cpp", UriKind.RelativeOrAbsolute), Region = new Region { StartLine = 42 } })); }
public void CppCheckLocation_CanBeDebugPrinted() { string result = new CppCheckLocation("cute_fluffy_kittens.c", 1234).ToString(); result.Should().Contain("cute_fluffy_kittens.c"); result.Should().Contain("1234"); }
private static CppCheckLocation AssertLocationIsTestLocation(CppCheckLocation result) { Assert.AreEqual("foo.cpp", result.File); Assert.AreEqual(1234, result.Line); return result; }
public void CppCheckLocation_CanBeConstructedFromFileAndLine() { var uut = new CppCheckLocation("1234", 42); Assert.AreEqual("1234", uut.File); Assert.AreEqual(42, uut.Line); }
public void CppCheckLocation_SatisfiesEqualityInvariants() { var a = new CppCheckLocation("a.cpp", 1); var b = new CppCheckLocation("a.cpp", 2); var c = new CppCheckLocation("b.cpp", 1); Assert.AreNotEqual(a, b); Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode()); Assert.AreNotEqual(a, c); Assert.AreNotEqual(a.GetHashCode(), c.GetHashCode()); Assert.AreNotEqual(b, c); Assert.AreNotEqual(b.GetHashCode(), c.GetHashCode()); var anotherA = new CppCheckLocation("a.cpp", 1); Assert.AreEqual(a, anotherA); Assert.AreEqual(a.GetHashCode(), anotherA.GetHashCode()); Assert.IsTrue(a == anotherA); Assert.IsFalse(a != anotherA); Assert.IsFalse(a.Equals(null)); Assert.IsFalse(a.Equals("a string value")); }