public void Clone() { ICloneable authors = new Authors(AuthorStringNameEmailHomepage, AuthorName, AuthorStringNameEmail); if (authors.Clone() is Authors clone) { Assert.IsTrue(AuthorStringNameEmailHomepage == clone[0]); Assert.IsTrue(AuthorName == clone[1]); Assert.IsTrue(AuthorStringNameEmail == clone[2]); } else { Assert.Fail($"{nameof( clone )} is not an instance of Authors."); } }
public void CompareTo_object() { var authors = new Authors(AuthorName, AuthorStringNameEmailHomepage); var objectBare = new object(); Assert.Throws <NotSupportedException>( // ReSharper disable once ReturnValueOfPureMethodIsNotUsed () => authors.CompareTo(objectBare), Authors.ExceptionComparisonNotSupported ); Assert.Throws <NotSupportedException>( // ReSharper disable once ReturnValueOfPureMethodIsNotUsed // ReSharper disable once ExpressionIsAlwaysNull () => authors.CompareTo((object)null), Authors.ExceptionComparisonNotSupported ); }
public void AreEqual_StringArray() { var authors = new Authors(new Author(AuthorName), new Author(AuthorStringNameEmail)); Assert.IsTrue(authors.Equals(new[] { AuthorName, AuthorStringNameEmail })); }
public void AreEqual_String() { var authors = new Authors(new Author(AuthorName), new Author(AuthorStringNameEmail)); Assert.IsTrue(authors.Equals($"[\"{AuthorName}\", \"{AuthorStringNameEmail}\"]")); }
public void Count() { var authors = new Authors(new Author(AuthorName), new Author(AuthorStringNameEmail)); Assert.AreEqual(2, authors.Count); }