public void ImplicitOperator_ToString() { // Arrange string id = "testId"; string infoIdentifier = new InfoIdentifier(id); // Act + Assert Assert.That(id, Is.EqualTo(infoIdentifier)); }
public void Constructor_SetsStringRepresentation() { // Arrange string id = "testId"; var infoIdentifier = new InfoIdentifier(id); // Act + Assert Assert.That(infoIdentifier.StringRepresentation, Is.EqualTo(id)); }
public void ImplicitOperator_FromString() { // Arrange InfoIdentifier id = "testId"; var infoIdentifier = new InfoIdentifier("testId"); // Act + Assert Assert.That(id, Is.EqualTo(infoIdentifier)); }
public void WriteJson_SerializesCorrectly() { // Arrange var infoIdentifier = new InfoIdentifier("1.2.3"); // Act var result = JsonConvert.SerializeObject(infoIdentifier); // Assert Assert.That(result, Is.EqualTo("\"1.2.3\"")); }
public void Equals_DoesNotMatchNull() { // Arrange var infoIdentifier = new InfoIdentifier("test"); // Act var result = infoIdentifier.Equals(null); // Arrange Assert.That(result, Is.False); }
public void Equals_MatchEqualObject(string firstId, string secondId, bool expectedResult) { // Arrange var firstInfoIdentifier = new InfoIdentifier(firstId); var secondInfoIdentifier = new InfoIdentifier(secondId); // Act bool result = firstInfoIdentifier.Equals(secondInfoIdentifier); // Assert Assert.That(result, Is.EqualTo(expectedResult)); }
public void Equals_SeriesWithSameUIDAreEqual() { // Arrange var infoIdentifier = new InfoIdentifier("123"); var series1 = new SeriesInfo { SeriesInstanceUID = infoIdentifier }; var series2 = new SeriesInfo { SeriesInstanceUID = infoIdentifier }; // Act var result = series1.Equals(series2); // Assert Assert.That(result, Is.True); }
public void Equals_StudiesWithSameUIDAreEqual() { // Arrange var infoIdentifier = new InfoIdentifier("123"); var study1 = new StudyInfo { StudyInstanceUID = infoIdentifier }; var study2 = new StudyInfo { StudyInstanceUID = infoIdentifier }; // Act var result = study1.Equals(study2); // Assert Assert.That(result, Is.True); }
public void ToString_ReturnsStringRepresentation() { // Arrange string id = "testId"; var infoIdentifier = new InfoIdentifier(id); // Act var result = infoIdentifier.ToString(); // Assert Assert.That(result, Is.EqualTo(id)); }
public void GetHashCode_SameCodeForEqualObjects() { // Arrange string id = "testId"; var firstInfoIdentifier = new InfoIdentifier(id); var secondInfoIdentifier = new InfoIdentifier(id); // Act int firstHashCode = firstInfoIdentifier.GetHashCode(); int secondHashCode = secondInfoIdentifier.GetHashCode(); // Assert Assert.That(firstHashCode, Is.EqualTo(secondHashCode)); }
public void GetHashCode_PatientsWithSameIDAndNameAreEqual() { // Arrange var infoIdentifier = new InfoIdentifier("123"); var study1 = new StudyInfo { StudyInstanceUID = infoIdentifier }; var study2 = new StudyInfo { StudyInstanceUID = infoIdentifier }; // Act var hash1 = study1.GetHashCode(); var hash2 = study2.GetHashCode(); // Assert Assert.That(hash1, Is.EqualTo(hash2)); }
public void GetHashCode_SeriesWithSameUIDAreEqual() { // Arrange var infoIdentifier = new InfoIdentifier("123"); var series1 = new SeriesInfo { SeriesInstanceUID = infoIdentifier }; var series2 = new SeriesInfo { SeriesInstanceUID = infoIdentifier }; // Act var hash1 = series1.GetHashCode(); var hash2 = series2.GetHashCode(); // Assert Assert.That(hash1, Is.EqualTo(hash2)); }
public void Equals_WithDifferentType_ReturnsFalse() { // Arrange var infoIdentifier = new InfoIdentifier("123"); var series = new SeriesInfo { SeriesInstanceUID = infoIdentifier }; // Act var result = series.Equals(new object()); // Assert Assert.That(result, Is.False); }
public void Equals_WithNull_ReturnsFalse() { // Arrange var infoIdentifier = new InfoIdentifier("123"); var study = new StudyInfo { StudyInstanceUID = infoIdentifier }; // Act var result = study.Equals(null); // Assert Assert.That(result, Is.False); }
public void Equals_WithItself_ReturnsTrue() { // Arrange var infoIdentifier = new InfoIdentifier("123"); var series = new SeriesInfo { SeriesInstanceUID = infoIdentifier }; // Act var result = series.Equals(series); // Assert Assert.That(result, Is.True); }
public void Equals_DoesMatchString() { // Arrange var infoIdentifier = new InfoIdentifier("test"); // Act var result = infoIdentifier.Equals("test"); // Arrange Assert.That(result, Is.True); }
public void Equals_WithDifferentType_ReturnsFalse() { var infoIdentifier = new InfoIdentifier("123"); var study = new StudyInfo { StudyInstanceUID = infoIdentifier }; // Act var result = study.Equals(new object()); // Assert Assert.That(result, Is.False); }