Ejemplo n.º 1
0
 public UpdateLocationCommandHandlerTests()
 {
     clientId   = CommandArrangeHelper.GetClientId(context);
     addressId  = CommandArrangeHelper.GetAddressId(context, null);
     locationId = CommandArrangeHelper.GetLocationId(context, clientId, addressId);
     sut        = new UpdateLocationCommandHandler(context);
 }
Ejemplo n.º 2
0
        public UpdateLocationTests()
        {
            _location = new Location {
                Id = 1, Name = "Location", Description = "Description"
            };
            var locationRepositoryMock = new Mock <IContentLocationRepository>();

            locationRepositoryMock
            .Setup(a => a.GetEntity(It.IsAny <int>()))
            .ReturnsAsync((int id) => id == 1 ? _location : null);
            locationRepositoryMock
            .Setup(a => a.UpdateEntity(It.IsAny <Location>()))
            .Returns(Task.CompletedTask)
            .Callback((Location location) => _location = location);
            _locationRepository = locationRepositoryMock.Object;

            _handler = new UpdateLocationCommandHandler(_locationRepository);
        }