public CreateTransitionCommandHandler(
     IContentLocationRepository locationRepository,
     IContentTransitionRepository transitionRepository)
 {
     _locationRepository   = locationRepository;
     _transitionRepository = transitionRepository;
 }
Beispiel #2
0
        public CreateTransitionTests()
        {
            var locations = new List <Location>
            {
                new Location {
                    Id = 1
                },
                new Location {
                    Id = 2
                },
                new Location {
                    Id = 3
                },
            };

            var locationRepositoryMock = new Mock <IContentLocationRepository>();

            locationRepositoryMock
            .Setup(a => a.GetEntity(It.IsAny <int>()))
            .ReturnsAsync((int id) => locations.FirstOrDefault(x => x.Id == id));
            _locationRepository = locationRepositoryMock.Object;

            var transitionRepositoryMock = new Mock <IContentTransitionRepository>();

            transitionRepositoryMock
            .Setup(a => a.AddEntity(It.IsAny <Transition>()))
            .Returns(Task.CompletedTask)
            .Callback((Transition t) => { _lastAddedTransition = t; });
            transitionRepositoryMock
            .Setup(a => a.ExistTransitionBetween(1, 2))
            .ReturnsAsync(true);
            transitionRepositoryMock
            .Setup(a => a.ExistTransitionBetween(1, 3))
            .ReturnsAsync(false);
            _transitionRepository = transitionRepositoryMock.Object;

            _handler = new CreateTransitionCommandHandler(_locationRepository, _transitionRepository);
        }
 public GetTransitionsFromLocationQueryHandler(IContentTransitionRepository transitionRepository)
 {
     _transitionRepository = transitionRepository;
 }
Beispiel #4
0
 public DeleteTransitionCommandHandler(IContentTransitionRepository transitionRepository)
 {
     _transitionRepository = transitionRepository;
 }