public void Initialize()
 {
     clientsRepository       = Substitute.For <IClientRepository>();
     shareRepository         = Substitute.For <IShareRepository>();
     clientsSharesRepository = Substitute.For <IClientsSharesRepository>();
     logger = Substitute.For <ILogger>();
     clientsSharesRepository.LoadClientsSharesByID(Arg.Any <ClientsSharesInfo>()).Returns((callInfo) =>
     {
         if (callInfo.Arg <ClientsSharesInfo>().ClientID == 1 && callInfo.Arg <ClientsSharesInfo>().ShareID == 2)
         {
             return(new ClientsSharesEntity()
             {
                 ClientID = callInfo.Arg <ClientsSharesInfo>().ClientID,
                 ShareID = callInfo.Arg <ClientsSharesInfo>().ShareID,
                 Amount = 15
             });
         }
         else
         {
             return(null);
         }
     });
     clientsRepository.LoadClientByID(Arg.Any <int>()).Returns((callInfo) =>
     {
         if (callInfo.Arg <int>() == 1 || callInfo.Arg <int>() == 2)
         {
             return(new ClientEntity()
             {
                 ClientID = callInfo.Arg <int>()
             });
         }
         else
         {
             return(null);
         }
     });
     shareRepository.LoadShareByID(Arg.Any <int>()).Returns((callInfo) =>
     {
         if (callInfo.Arg <int>() == 1 || callInfo.Arg <int>() == 2)
         {
             return(new ShareEntity()
             {
                 ShareID = callInfo.Arg <int>()
             });
         }
         else
         {
             return(null);
         }
     });
 }
Exemplo n.º 2
0
 public void Initialize()
 {
     clientsSharesRepository = Substitute.For <IClientsSharesRepository>();
     clientsSharesRepository.LoadClientsSharesByID(Arg.Any <ClientsSharesInfo>()).Returns((callInfo) =>
                                                                                          { if (callInfo.Arg <ClientsSharesInfo>().ClientID == 1 && callInfo.Arg <ClientsSharesInfo>().ShareID == 2)
                                                                                            {
                                                                                                return(new ClientsSharesEntity()
             {
                 ClientID = 1,
                 ShareID = 2,
                 Amount = 15
             });
                                                                                            }
                                                                                            else
                                                                                            {
                                                                                                return(null);
                                                                                            } });
 }
Exemplo n.º 3
0
 public ClientsSharesService(IClientsSharesRepository clientsSharesRepository, IValidator validator)
 {
     this.clientsSharesRepository = clientsSharesRepository;
     this.validator = validator;
 }
 public ClientsSharesService(IClientsSharesRepository clientsSharesRepository)
 {
     this.clientsSharesRepository = clientsSharesRepository;
 }
Exemplo n.º 5
0
 public TradeValidator(IClientRepository clientsRepository, IClientsSharesRepository clientsSharesRepository)
 {
     this.clientsRepository       = clientsRepository;
     this.clientsSharesRepository = clientsSharesRepository;
 }