public static ComparisonResult <T> Compare <T>(this ICompareLogic compareLogic, T expectedObject, T actualObject) { Validate(compareLogic.Config); ComparisonResult comparisonResult = compareLogic.Compare(expectedObject, actualObject); return(new ComparisonResult <T>(comparisonResult)); }
/// <summary> /// Initializes a new instance of the <see cref="CompareNetObjectsBasedFactComparer"/> class. /// </summary> /// <param name="logic">The comparer.</param> /// <exception cref="System.ArgumentNullException">Thrown when the <paramref name="logic">comparer</paramref> is <c>null</c>.</exception> public CompareNetObjectsBasedFactComparer(ICompareLogic logic) { if (logic == null) { throw new ArgumentNullException(nameof(logic)); } _logic = logic; }
/// <summary> /// Initializes a new instance of the <see cref="CompareNetObjectsBasedEventComparer"/> class. /// </summary> /// <param name="logic">The compare logic.</param> /// <exception cref="System.ArgumentNullException">Thrown when the <paramref name="logic"/> is <c>null</c>.</exception> public CompareNetObjectsBasedEventComparer(ICompareLogic logic) { if (logic == null) { throw new ArgumentNullException("logic"); } _logic = logic; }
public FlightService(IAviationstackFlightService aviationstackFlightService, IMapper mapper, IFlightRepository repository, UserManager <User> userManager, ICompareLogic compareLogic) { this.aviationstackFlightService = aviationstackFlightService; this.mapper = mapper; this.repository = repository; this.userManager = userManager; this.compareLogic = compareLogic; }
/// <summary> /// Throws a CompareException if the classes are equal /// </summary> public static void AssertNotEqual <T>(this ICompareLogic compareLogic, T expected, T actual, string message = null) { ComparisonResult result = compareLogic.Compare(expected, actual); if (result.AreEqual) { throw new CompareException(result, BuildExpectedNotEqualMessage(message, result)); } }
public StudentViewServiceTests() { this.studentServiceMock = new Mock <IStudentService>(); this.userServiceMock = new Mock <IUserService>(); this.dateTimeBrokerMock = new Mock <IDateTimeBroker>(); this.loggingBrokerMock = new Mock <ILoggingBroker>(); var compareConfig = new ComparisonConfig(); compareConfig.IgnoreProperty <Student>(student => student.Id); compareConfig.IgnoreProperty <Student>(student => student.UserId); this.compareLogic = new CompareLogic(compareConfig); this.studentViewService = new StudentViewService( studentService: this.studentServiceMock.Object, userService: this.userServiceMock.Object, dateTimeBroker: this.dateTimeBrokerMock.Object, loggingBroker: this.loggingBrokerMock.Object); }
public BookViewServiceTests() { this._bookServiceMock = new Mock <IBookService>(); this._userServiceMock = new Mock <IUserService>(); this._dateTimeBrokerMock = new Mock <IDateTimeBroker>(); this._loggingBrokerMock = new Mock <ILoggingBroker>(); var compareConfig = new ComparisonConfig(); compareConfig.IgnoreProperty <Book>(book => book.Id); // compareConfig.IgnoreProperty<Book>(book => book.BookId); this._compareLogic = new CompareLogic(compareConfig); //this.bookViewService = new BookViewService( // bookService: _bookServiceMock.Object, // userService: _userServiceMock.Object, // dateTimeBroker: _dateTimeBrokerMock.Object, // loggingBroker: _loggingBrokerMock.Object); }
public FlightServiceTest() { var userStore = Mock.Of <IUserStore <User> >(); this.userManager = new Mock <UserManager <User> >(userStore, null, null, null, null, null, null, null, null); this.repository = new Mock <IFlightRepository>(); var fliightMappingProfile = new FlightMapping(); this.aviationstackFlightService = new Mock <IAviationstackFlightService>(); this.compareLogic = new CompareLogic(); var configuration = new MapperConfiguration(cfg => cfg.AddProfile(fliightMappingProfile)); this.mapper = new Mapper(configuration); this.service = new FlightService(aviationstackFlightService.Object, mapper, repository.Object, userManager.Object, compareLogic); }
private static void Ignore(Maybe <Property> property, ICompareLogic comparison) { comparison.Config.MembersToIgnore.Add(property.Value.Name); comparison.Config.MembersToIgnore.Add($"<{property.Value.Name}>k__BackingField"); }
private static void Ignore(Maybe <Field> field, ICompareLogic comparison) { comparison.Config.MembersToIgnore.Add(field.Value.Name); }
/// <summary> /// Initializes a new instance of the <see cref="CompareNetObjectsBasedExceptionComparer"/> class. /// </summary> /// <param name="logic">The compare logic.</param> /// <exception cref="System.ArgumentNullException">Thrown when the <paramref name="logic"/> is <c>null</c>.</exception> public CompareNetObjectsBasedExceptionComparer(ICompareLogic logic) { if (logic == null) throw new ArgumentNullException("logic"); _logic = logic; }
/// <summary> /// Initializes a new instance of the <see cref="CompareNetObjectsBasedResultComparer"/> class. /// </summary> /// <param name="logic">The comparer.</param> /// <exception cref="System.ArgumentNullException">Thrown when the <paramref name="logic"/> is <c>null</c>.</exception> public CompareNetObjectsBasedResultComparer(ICompareLogic logic) => _logic = logic ?? throw new ArgumentNullException(nameof(logic));