Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Location"/> class.
        /// </summary>
        /// <param name="agency">The agency.</param>
        /// <param name="locationProfile">The location profile.</param>
        protected internal Location(Agency agency, LocationProfile locationProfile)
            : this()
        {
            Check.IsNotNull(agency, () => Agency);
            Check.IsNotNull(locationProfile, () => LocationProfile);

            _agency = agency;
            _locationProfile = locationProfile;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates the location.
        /// </summary>
        /// <param name="agency">The agency.</param>
        /// <param name="locationProfile">The location profile.</param>
        /// <returns>
        /// A Location.
        /// </returns>
        public Location CreateLocation(Agency agency, LocationProfile locationProfile)
        {
            Check.IsNotNull(agency, "agency is required.");
            Check.IsNotNull(locationProfile, "locationProfile is required.");

            var newLocation = new Location ( agency, locationProfile );
            Location createdLocation = null;

            DomainRuleEngine.CreateRuleEngine ( newLocation, "CreateLocationRuleSet" )
                .Execute(() =>
                {
                    _locationRepository.MakePersistent(newLocation);
                    createdLocation = newLocation;
                });

            return createdLocation;
        }
        public void InitializeTest()
        {
            _apartmentsRepository = new FakeApartmentsRepository();
            _locationsRepository  = new FakeLocationsRepository();
            var apartmentsAutoMapperProfile = new ApartmentProfile();
            var locationsAutoMapperProfile  = new LocationProfile();
            var mapperConfigs = new MapperConfiguration(cfg =>
            {
                cfg.AddProfile(apartmentsAutoMapperProfile);
                cfg.AddProfile(locationsAutoMapperProfile);
            });
            var mapper = new Mapper(mapperConfigs);

            //Func<AuthorizationResult> authResult = authSucceeds ?
            //    (Func<AuthorizationResult>)AuthorizationResult.Success : AuthorizationResult.Failed;

            var iLoggerMock = new Mock <ILogger <ApartmentsController> >();

            _controller = new ApartmentsController(iLoggerMock.Object, _apartmentsRepository, _locationsRepository, mapper);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Determines if the values are equal.
 /// </summary>
 /// <param name="otherLocationProfile">The other location profile.</param>
 /// <param name="otherLocationProfileAgency">The other location profile agency.</param>
 /// <returns>
 /// A boolean denoting equality of the values.
 /// </returns>
 public virtual bool ValuesEqual(LocationProfile otherLocationProfile, Agency otherLocationProfileAgency)
 {
     return LocationProfile.LocationName.Name.Equals(otherLocationProfile.LocationName.Name)
            && Agency.Key == otherLocationProfileAgency.Key;
 }
Ejemplo n.º 5
0
        /// <summary>
        /// The revise location profile.
        /// </summary>
        /// <param name="locationProfile">
        /// The location profile.
        /// </param>
        public virtual void ReviseLocationProfile(LocationProfile locationProfile)
        {
            Check.IsNotNull(locationProfile, () => LocationProfile);

            LocationProfile = locationProfile;
        }