예제 #1
0
        public SectorUpdatedEV(
            IProcessLogger logger,
            SectorRepository repository
            )
            : base(logger)
        {
            // Conditions
            repository.Requires(nameof(repository)).IsNotNull();
            this.repository = repository;

            // Validation rules

            RuleFor(x => x.TenantUniqueId)
            .NotNull()
            .NotEqual(new Guid());

            RuleFor(x => x.UserUniqueId)
            .NotNull()
            .NotEqual(new Guid());

            RuleFor(x => x.CorrelationUniqueId)
            .NotNull()
            .NotEqual(new Guid());

            RuleFor(x => x.UniqueId)
            .NotNull()
            .NotEqual(new Guid());
        }
예제 #2
0
 public UnitOfWork(ApplicationDbContext context)
 {
     this.context = context;
     Sectors      = new SectorRepository(context);
     Users        = new UserRepository(context);
     UserSectors  = new UserSectorsRepository(context);
 }
예제 #3
0
 public UnitOfWork(bool test = false)
 {
     if (!test && !Test)
     {
         AccountTypes   = new AccountTypeRepository(new AccountTypeOracleContext());
         Employees      = new EmployeeRepository(new EmployeeOracleContext());
         AttachedTracks = new AttachedTrackRepository(new AttachedTrackOracleContext());
         Routes         = new RouteRepository(new RouteOracleContext());
         Sectors        = new SectorRepository(new SectorOracleContext());
         Statuses       = new StatusRepository(new StatusOracleContext());
         Tracks         = new TrackRepository(new TrackOracleContext());
         //TrackRoutes = new TrackRouteRepository(new TrackRouteOracleContext());
         Trams      = new TramRepository(new TramOracleContext());
         TramRoutes = new TramRouteRepository(new TramRouteOracleContext());
         Tasks      = new TaskRepository(new TaskOracleContext());
     }
     else
     {
         AccountTypes   = new AccountTypeRepository(new AccountTypeTestContext());
         Employees      = new EmployeeRepository(new EmployeeTestContext());
         Tracks         = new TrackRepository(new TrackTestContext());
         Sectors        = new SectorRepository(new SectorTestContext());
         Trams          = new TramRepository(new TramTestContext());
         Routes         = new RouteRepository(new RouteTestContext());
         AttachedTracks = new AttachedTrackRepository(new AttachedTrackTestContext());
         TramRoutes     = new TramRouteRepository(new TramRouteTestContext());
         TrackRoutes    = new TrackRouteRepository(new TrackRouteTestContext());
         TramStatuses   = new TramStatusRepository(new TramStatusTestContext());
     }
 }
예제 #4
0
        /// <summary>
        /// Obtiene todos los sectores existentes.
        /// </summary>
        /// <returns></returns>
        public ResultadoOperacionDto ObtenerSectores()
        {
            ResultadoOperacionDto resultadoOperacionDto = new ResultadoOperacionDto();

            resultadoOperacionDto.InformacionExtra = SectorRepository.ObtenerSectores();
            resultadoOperacionDto.Resultado        = true;
            return(resultadoOperacionDto);
        }
        public void Test_Get_Should_Return_Sectors()
        {
            //Arrange
            IRepository <Sector> repository = new SectorRepository(context);

            //Act
            var sectorList = repository.Get();

            //Assert
            var actualCount = sectorList.Count();

            Assert.That(GetSectorList().Count, Is.EqualTo(2), "List of students is not matching");
        }
예제 #6
0
        public Location(string name, Position position)
        {
            Name     = name;
            Position = position;
            Seeds    = new List <Seed>();
            var sectorRepo = new SectorRepository();

            Sector = sectorRepo.Get(position);
            Sector.Locations.Add(this);

            Entities = new List <IEntity>();
            Id       = Id.FromParts('L', position, todoTrunk);
        }
예제 #7
0
        public static Location GetOrCreate(Position position, Player player)
        {
            var repo   = new SectorRepository(); //TODO: Manage this in another way
            var sector = repo.Get(position);

            var candidate = sector.Get(position, player.Party);

            if (candidate == null)
            {
                return(sector.Create(position));
            }
            else
            {
                return(candidate);
            }
        }
예제 #8
0
        public void Test_Update_ShouldUpdateSector()
        {
            IRepository <Sector> repository = new SectorRepository(context);

            context.Sector.Add(GetSector());
            SectorDto s1 = new SectorDto();

            s1.Id         = 3;
            s1.SectorName = "Construction";
            s1.About      = "Construction Companies";

            //Act
            var    sec_ = repository.UpdateSectorDetails(s1);
            Sector s2   = context.Sector.Find(GetSector().Id);

            //Assert

            Console.WriteLine(sec_);
            Assert.That(s2.SectorName,
                        Is.EqualTo("Construction"),
                        "Sector List does NOT match");
        }
예제 #9
0
 public SectorController(ApplicationDbContext ctx, SectorRepository SectorRepo)
 {
     context     = ctx;
     _SectorRepo = SectorRepo;
 }
예제 #10
0
 public SectorUpdatedEH(SectorRepository repository)
     : base(repository)
 {
 }