示例#1
0
 //TODO refactor to take viewmodel
 public void AddGirlScoutToTroop(NewGirlScoutDto girlScout, int troopId)
 {
     using (var uow = UnitOfWork)
     {
         var command = new AddGirlScoutCommand(girlScout.FirstName, girlScout.LastName, girlScout.ParentFirstName,
                                               girlScout.ParentLastName, girlScout.PhoneNumber, troopId);
         var handler = new AddGirlScoutCommandHandler(uow);
         var result  = handler.Handle(command);
     }
 }
示例#2
0
        public void AddGirlScout_Fails()
        {
            _unitOfWork.Setup(f => f.Get <Troop>(It.IsAny <int>())).Returns(default(Troop));

            var command = new AddGirlScoutCommand("Addelleigh", "Cupp", "Danielle", "Cupp", "(619) 995-8257", 1);
            var handler = new AddGirlScoutCommandHandler(_unitOfWork.Object);
            var result  = handler.Handle(command);

            result.IsFailure.Should().BeTrue();
            _troop.GirlScouts.Count.Should().Be(0);
        }
示例#3
0
        public void AddGirlScout_Succeeds()
        {
            _unitOfWork.Setup(f => f.Get <Troop>(It.IsAny <int>())).Returns(_troop);

            var command = new AddGirlScoutCommand("Addelleigh", "Cupp", "Danielle", "Cupp", "(619) 995-8257", 1);
            var handler = new AddGirlScoutCommandHandler(_unitOfWork.Object);
            var result  = handler.Handle(command);

            result.IsSuccess.Should().BeTrue();
            _troop.GirlScouts.Count.Should().Be(1);
            _troop.GirlScouts.First().Inventory.Stacks.Count.Should().Be(8);
        }