示例#1
0
        /// <summary>
        /// Constructor For Setting RL, BL, Controller Instances.
        /// </summary>
        public Tests()
        {
            this.dbContext = new ParkingLotDBContext(dbContextOptions);
            var myConfiguration = new Dictionary <string, string>
            {
                { "Jwt:Key", "ThisismySecretKey" },
                { "Jwt:Issuer", "ParkingLot.com" },
                { "Jwt:Audiance", "ParkingLot.com" },
                { "Logging:LogLevel:Default", "Warning" },
                { "AllowedHosts", "*" },
                { "ConnectionStrings:ParkingLotConnectionString", "Server=localhost\\SQLEXPRESS;Database=ParkingLotDB;Trusted_Connection=True;" }
            };

            this.configuration = new ConfigurationBuilder().AddInMemoryCollection(myConfiguration).Build();

            distributedCache = new RedisCache(new RedisCacheOptions
            {
                Configuration = "parkinglot.redis.cache.windows.net:6380,password=RxLRe+cHYDzGro4UX8D4VtkfsifZ93ZM8CJlKI5Tobw=,ssl=True,abortConnect=False",
                InstanceName  = "master"
            });

            userRL         = new UserRL(dbContext);
            userBL         = new UserBL(userRL);
            userController = new UserController(userBL, configuration);

            parkingLotRL      = new ParkingLotRL(dbContext);
            parkingLotBL      = new ParkingLotBL(parkingLotRL);
            parkingController = new ParkingController(parkingLotBL, distributedCache);
        }
示例#2
0
        public void Parking_StatusShouldReturnNotFound()
        {
            //Setting Data.
            var           dbContext    = new ParkingLotDBContext(dbContextOptions);
            IParkingLotRL parkingLotRL = new ParkingLotRL(dbContext)
            {
                TotalLotLimit = 0
            };
            IParkingLotBL     parkingLotBL      = new ParkingLotBL(parkingLotRL);
            ParkingController parkingController = new ParkingController(parkingLotBL, distributedCache);

            //Act
            var response        = parkingController.CheckLotStatus() as NotFoundObjectResult;
            var jsonResponse    = JToken.Parse(JsonConvert.SerializeObject(response.Value));
            var responseSuccess = jsonResponse["Success"].ToObject <bool>();
            var responseMessage = jsonResponse["Message"].ToString();

            //Expected Values.
            string Message = "Lot Is Full";

            //Asserting Values.
            Assert.IsType <NotFoundObjectResult>(response);
            Assert.Equal(SuccessFalse, responseSuccess);
            Assert.Equal(Message, responseMessage);
        }
示例#3
0
 public VehicleRepository(ParkingLotDBContext dataContext) : base(dataContext)
 {
 }
示例#4
0
 public Lab08ParkingLotUnitOfWork(ParkingLotDBContext parkingLotDBContext)
 {
     _parkingLotDBContext = parkingLotDBContext;
 }
示例#5
0
 /// <summary>
 /// Constructor For Setting DBContext Instance.
 /// </summary>
 /// <param name="dBContext"></param>
 public UserRL(ParkingLotDBContext dBContext)
 {
     this.dBContext = dBContext;
 }
示例#6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RepositoryBase{T}"/> class.
 /// </summary>
 /// <param name="dataContext">The data context.</param>
 public RepositoryBase(ParkingLotDBContext dataContext)
 {
     DataContext = dataContext;
 }