Exemple #1
0
        public PrePlanningApiControllerTest()
        {
            var serviceProvider = services.BuildServiceProvider();

            prePlanningAppService  = serviceProvider.GetService <IPrePlanningAppService>();
            authorizationService   = serviceProvider.GetService <IAuthorizationService>();
            lookUpService          = serviceProvider.GetService <ILookUpService>();
            verificationService    = serviceProvider.GetService <IVerificationService>();
            rootConfigurationsMock = SetupConfigurations.GetApplicationConfiguration(Directory.GetCurrentDirectory());
            _prePlanningController = new PrePlanningController(prePlanningAppService, lookUpService, verificationService, rootConfigurationsMock.Object);
        }
Exemple #2
0
        public async Task CreateVerificationCode_Success()
        {
            var _planningId = 1;

            _claims = new Claim[3] {
                new Claim(IdentityConfigs.Claims.Email, "*****@*****.**"),
                new Claim(IdentityConfigs.Claims.Mobile, "0593321765"),
                new Claim("sub", "123")
            };
            _prePlanningController = _prePlanningController.WithIdentity(_claims);

            await _prePlanningController.CreateVerificationCode(_planningId);
        }
Exemple #3
0
        public async Task Deactivate_Returns_Data()
        {
            var _id = 2;

            _claims = new Claim[1] {
                new Claim(IdentityConfigs.Claims.Role, "12"),
            };
            _prePlanningController = _prePlanningController.WithIdentity(_claims);

            var result = await _prePlanningController.Deactivate(_id);

            Assert.IsType <int>(result);
            Assert.Equal(_id, result);
        }
Exemple #4
0
        public async Task FindPrePlanningBySearchCriteria_Returns_Data()
        {
            var _prePlanningSearchCriteria = new PrePlanningSearchCriteria()
            {
                AgencyCode = "022001000000"
            };

            _claims = new Claim[2] {
                new Claim(IdentityConfigs.Claims.isSemiGovAgency, "1"),
                new Claim(IdentityConfigs.Claims.SelectedCR, "022001000000")
            };
            _prePlanningController = _prePlanningController.WithIdentity(_claims);

            var result = await _prePlanningController.FindPrePlanningBySearchCriteria(_prePlanningSearchCriteria);

            Assert.NotNull(result);
            Assert.IsType <QueryResult <PrePlanningModel> >(result);
            Assert.NotEmpty(result.Items);
            Assert.True(result.TotalCount > 0);
            Assert.True(result.PageNumber > 0);
            Assert.True(result.PageSize > 0);
        }
Exemple #5
0
        public async Task Add_Success()
        {
            var _prePlanningModel = new PrePlanningModel()
            {
                AgencyCode         = "022001000000",
                BranchId           = 1,
                InsideKSA          = true,
                ProjectName        = "Functional Test" + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Millisecond,
                ProjectNature      = "Testing",
                ProjectDescription = "API Functional Test",
                Duration           = "1",
                YearQuarterId      = 4,
                DurationInDays     = 1,
                DurationInMonths   = 2,
                DurationInYears    = 3
            };

            _claims = new Claim[3] {
                new Claim(IdentityConfigs.Claims.BranchId, "1"),
                new Claim(IdentityConfigs.Claims.isSemiGovAgency, "1"),
                new Claim(IdentityConfigs.Claims.SelectedCR, "022001000000")
            };
            _prePlanningController = _prePlanningController.WithIdentity(_claims);

            var result = await _prePlanningController.Add(_prePlanningModel);

            Assert.NotNull(result);
            Assert.IsType <PrePlanningModel>(result);
            Assert.Equal(_prePlanningModel.AgencyCode, result.AgencyCode);
            Assert.Equal(_prePlanningModel.ProjectName, result.ProjectName);
            Assert.Equal(_prePlanningModel.ProjectNature, result.ProjectNature);
            Assert.Equal(_prePlanningModel.ProjectDescription, result.ProjectDescription);
            Assert.Equal(_prePlanningModel.Duration, result.Duration);
            Assert.Equal(_prePlanningModel.YearQuarterId, result.YearQuarterId);
            Assert.True(result.InsideKSA);
        }