public BodyMeasurementsController(GetAllBodyMeasurementsHandler getAllBodyMeasurementsHandler, GetBodyMeasurementHandler getBodyMeasurementHandler, DeleteBodyMeasurementHandler deleteBodyMeasurementHandler, CreateOrEditBodyMeasurementHandler createOrEditBodyMeasurementHandler) { _getAllBodyMeasurementsHandler = getAllBodyMeasurementsHandler; _getBodyMeasurementHandler = getBodyMeasurementHandler; _deleteBodyMeasurementHandler = deleteBodyMeasurementHandler; _createOrEditBodyMeasurementHandler = createOrEditBodyMeasurementHandler; }
public void SetUp() { BodyFitTrackerContext bodyFitTrackerContext = DatabaseConnectionFactory.GetInMemoryDatabase(true); AppUser appUser = new AppUser("*****@*****.**", "", "", 60, GenderType.Male, MeasurementSystem.Imperial); bodyFitTrackerContext.AppUsers.Add(appUser); bodyFitTrackerContext.BodyMeasurements.Add(new BodyMeasurement(appUser, 11, 12, null, 60, 120, DateTime.Today, MeasurementSystem.Imperial)); bodyFitTrackerContext.SaveChanges(); var userAccessorMock = new Mock <IUserAccessor>(); userAccessorMock.Setup(x => x.GetCurrentUserId()).Returns(appUser.AppUserId); MapperConfiguration mapperConfiguration = new MapperConfiguration(opts => { opts.AddProfile(new BodyMeasurementsMappingProfile()); }); IMapper mapper = mapperConfiguration.CreateMapper(); _getBodyMeasurementHandler = new GetBodyMeasurementHandler(bodyFitTrackerContext, mapper, userAccessorMock.Object); }