コード例 #1
0
        public async Task CreateLifte_WithValidInput_ShouldBeReturnTrue()
        {
            this.liftsService = this.InitializeCategoriesService();

            var isCreated = await CreateLiftAsync(this.liftsService);

            Assert.True(isCreated);
        }
コード例 #2
0
 public FollowsController(
     IDeletableEntityRepository <Follow> followRepository,
     IFollowsService followsService,
     ILiftsService liftsService,
     UserManager <ApplicationUser> userManager)
 {
     this.followRepository = followRepository;
     this.followsService   = followsService;
     this.liftsService     = liftsService;
     this.userManager      = userManager;
 }
コード例 #3
0
 public LiftsController(
     ILiftsService liftService,
     ICitiesService cityService,
     IManufacturersService manufacturerService,
     UserManager <ApplicationUser> userManager)
 {
     this.liftService         = liftService;
     this.cityService         = cityService;
     this.manufacturerService = manufacturerService;
     this.userManager         = userManager;
 }
コード例 #4
0
        public async Task GetAllLifts_WithValidInput_ShouldBeReturnCorrectData()
        {
            this.liftsService = this.InitializeCategoriesService();

            await CreateLiftAsync(this.liftsService);
            await CreateLiftAsync(this.liftsService);
            await CreateLiftAsync(this.liftsService);

            var lifts = await this.liftsService.GetAllLifts(1, 2);

            Assert.NotNull(lifts);
        } // Triabva da se preraboti
コード例 #5
0
        public async Task GetLiftWithRegistrationNumber_WithValidInput_ShouldBeReturnCorrectLift()
        {
            this.liftsService = this.InitializeCategoriesService();

            await CreateLiftAsync(this.liftsService);

            var lift = this.repository.All().FirstOrDefaultAsync().Result;

            var currentLift = this.liftsService.GetLiftWithRegistrationNumber(lift.RegistrationNumber);

            Assert.Equal(lift.RegistrationNumber, currentLift.RegistrationNumber);
        }
コード例 #6
0
        public async Task GetLiftWithRegistrationNumber_WithInvalidInput_ShouldBeReturnNull(string input)
        {
            this.liftsService = this.InitializeCategoriesService();

            await CreateLiftAsync(this.liftsService);

            var lift = this.repository.All().FirstOrDefaultAsync().Result;

            var currentLift = this.liftsService.GetLiftWithRegistrationNumber(input);

            Assert.Null(currentLift);
            Assert.True(lift != currentLift);
        }
コード例 #7
0
 public InspectsController(
     ISupportCompaniesService supportCompaniesService,
     IInspectTypesService inspectTypesService,
     ILiftsService liftsService,
     IInspectsService inspectsService,
     UserManager <ApplicationUser> userManager)
 {
     this.supportCompaniesService = supportCompaniesService;
     this.inspectTypesService     = inspectTypesService;
     this.liftsService            = liftsService;
     this.inspectsService         = inspectsService;
     this.userManager             = userManager;
 }
コード例 #8
0
        public async Task GetLifts_WithInvalidInput_ShouldBeReturnNull(string input)
        {
            this.liftsService = this.InitializeCategoriesService();

            await CreateLiftAsync(this.liftsService);

            var lift = this.repository.All().FirstOrDefaultAsync().Result;

            Assert.NotNull(lift);

            var getLift = this.liftsService.GetLift(input);

            Assert.Null(getLift);
        }
コード例 #9
0
        public async Task GetCountAllActiveLifts_WithValidInput_ShouldBeReturnCorrectCount()
        {
            this.liftsService = this.InitializeCategoriesService();

            var count = this.liftsService.GetCountAllActiveLifts();

            Assert.Equal(0, count);

            await CreateLiftAsync(this.liftsService);

            count = this.liftsService.GetCountAllActiveLifts();

            Assert.Equal(1, count);
        }
コード例 #10
0
        public async Task AddSupportCompany__WithValidInput_ShouldBeReturnCorrectData()
        {
            this.liftsService = this.InitializeCategoriesService();

            await CreateLiftAsync(this.liftsService);

            var lift = this.repository.All().FirstOrDefaultAsync().Result;

            string supportCompanyId = "SP1";

            await this.liftsService.AddSupportCompany(lift.Id, supportCompanyId);

            Assert.Equal(supportCompanyId, lift.SupportCompanyId);
        }
コード例 #11
0
        public async Task GetCurrentLift_WithValidInput_ShouldBeReturnCorrectData()
        {
            this.liftsService = this.InitializeCategoriesService();

            await CreateLiftAsync(this.liftsService);

            var lift = this.repository.All().FirstOrDefaultAsync().Result;

            Assert.NotNull(lift);

            var getCurrentLift = this.liftsService.GetCurrentLift(lift.Id).Result;

            Assert.Null(getCurrentLift);
        } // Triabva da se preraboti
コード例 #12
0
        public async Task GetLifts_WithValidInput_ShouldBeReturnCorrectCount()
        {
            this.liftsService = this.InitializeCategoriesService();

            await CreateLiftAsync(this.liftsService);

            var lift = this.repository.All().FirstOrDefaultAsync().Result;

            Assert.NotNull(lift);

            var getLift = this.liftsService.GetLift(lift.Id);

            Assert.NotNull(getLift);
            Assert.Equal(lift.Id, getLift.Id);
        }
コード例 #13
0
        private static async Task <bool> CreateLiftAsync(ILiftsService liftsService)
        {
            string   userId           = "U1";
            LiftType liftType         = (LiftType)Enum.Parse(typeof(LiftType), "Пътнически");
            int      numberOfStops    = 4;
            int      capacity         = 450;
            DoorType doorType         = (DoorType)Enum.Parse(typeof(DoorType), "АВ");
            string   manufacturerId   = "M1";
            string   productionNumber = "123";
            string   cityId           = "C1";
            string   address          = "A1";

            var isCreated = await liftsService.CreateAsync(userId, liftType, numberOfStops, capacity, doorType, manufacturerId, productionNumber, cityId, address);

            return(isCreated);
        }
コード例 #14
0
        public async Task DeleteLift_WithValidInput_ShouldBeDeleteLift()
        {
            this.liftsService = this.InitializeCategoriesService();

            await CreateLiftAsync(this.liftsService);

            var lift = this.repository.All().FirstOrDefaultAsync().Result;

            await this.liftsService.DeleteAsync(lift.Id);

            lift = this.repository.All().FirstOrDefaultAsync().Result;
            var deleteLift = this.repository.AllWithDeleted().FirstOrDefaultAsync().Result;

            Assert.Null(lift);
            Assert.NotNull(deleteLift);
            Assert.Equal(DateTime.UtcNow.ToShortDateString(), deleteLift.DeletedOn.Value.ToShortDateString());
        }