public void EqualsBookStateTest() { BookState bookState1 = new BookState(new Book("123-456-789", "John Janowy", "Catchy Title", "Interesting Book"), true, new DateTime(1999, 12, 15)); BookState bookState2 = new BookState(new Book("123-456-789", "John Janowy", "Catchy Title", "Interesting Book"), true, new DateTime(1999, 12, 15)); BookState bookState3 = new BookState(new Book("987-654-321", "Jack Jakubowy", "Boring Title", "Casual Book"), true, new DateTime(2011, 1, 5)); Assert.IsTrue(bookState1.Equals(bookState2)); Assert.IsFalse(bookState1.Equals(bookState3)); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (!(value is BookState && parameter is BookState)) { throw new ApplicationException("Parameter Error in " + nameof(BookStateToVisibilityConverter)); } BookState valueEnum = (BookState)value; BookState parameterEnum = (BookState)parameter; return(valueEnum.Equals(parameterEnum) ? Visibility.Visible : Visibility.Hidden); }