コード例 #1
0
        public void ValidateAddBlock()
        {
            var expected = "Data successfully added";
            var result   = _controller.AddBlock(_blockRequest);

            Assert.AreEqual(expected, result.Value);
        }
コード例 #2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            string block       = txtBlockName.Text;
            string gender      = txtGender.Text;
            string description = txtDescription.Text;
            string status      = txtStatus.Text;

            BlockBuilding blockBuilding = new BlockBuilding();

            blockBuilding.setBlockName(block);
            blockBuilding.setGender(gender);
            blockBuilding.setDescription(description);
            blockBuilding.setStatus(status);

            BlockController blockController = new BlockController();
            bool            i = blockController.AddBlock(blockBuilding);

            if (i == true)
            {
                MessageBox.Show("Block has been added Successfully");
                txtBlockName.Text   = "";
                txtGender.Text      = "";
                txtDescription.Text = "";
                txtStatus.Text      = "";
            }
            else
            {
                MessageBox.Show("Block has not been added");
            }
        }
コード例 #3
0
        public async Task AddBlock_Returns_Throws_AlreadyBlocked()
        {
            var _branchId           = "3";
            var _agencyCode         = "019001000000";
            var _supplierBlockModel = new SupplierBlockModel()
            {
                SupplierBlockId          = 64,
                CommercialRegistrationNo = "1010274503",
                CommercialSupplierName   = "الشركة السعودية لتبادل المعلومات الكترونيا تبادل",
                AdminFileName            = "CR  العملات الأجنبية V2.2 (1).pdf",
                AdminFileNetReferenceId  = "idd_8A7F7375-6A6F-CAC5-8671-6D78C5300000",
                BlockDetails             = "منع دائم - قديم - تاريخ المنع - غدا",
                BlockTypeId      = 1,
                SupplierTypeId   = 1,
                IsOldSystem      = true,
                ResolutionNumber = "99",
                BlockStartDate   = DateTime.Now.AddDays(2),
                Punishment       = "نص العقوبة",
                AgencyCode       = "019001000000",
                BlockStatusId    = 5,
                IsTotallyBlocked = false
            };

            _claims = new Claim[4] {
                new Claim(IdentityConfigs.Claims.Role, RoleNames.MonafasatAdmin),
                new Claim(IdentityConfigs.Claims.isSemiGovAgency, "1"),
                new Claim(IdentityConfigs.Claims.SelectedCR, _agencyCode),
                new Claim(IdentityConfigs.Claims.BranchId, _branchId),
            };
            _blockController = _blockController.WithIdentity(_claims);
            var _expectedMessage = Resources.BlockResources.ErrorMessages.AlreadyBlocked;

            var result = await Assert.ThrowsAsync <BusinessRuleException>(() => _blockController.AddBlock(_supplierBlockModel));

            Assert.NotNull(result);
            Assert.Equal(_expectedMessage, result.Message);
        }