Beispiel #1
0
        public async Task <bool> Testfor_Validate_Invlid_BookPlan()
        {
            //Arrange
            bool res             = false;
            var  _customerUpdate = new Customer
            {
                CustomerId   = 1,
                UserName     = "******",
                PhoneNumber  = 9631438121,
                Address      = "a/3 Banglore",
                Email        = "*****@*****.**",
                Age          = 23,
                Region       = "Bihar",
                BusinessType = "Home"
            };

            _customerUpdate = null;
            //Act
            service.Setup(repo => repo.BookPlan(_plan.PlanId, _customerUpdate)).ReturnsAsync(_bookedPlan = null);
            var result = await _internetServices.BookPlan(_plan.PlanId, _customerUpdate);

            if (result == null)
            {
                res = true;
            }
            //Asert
            //final result displaying in text file
            await File.AppendAllTextAsync("../../../../output_exception_revised.txt", "Testfor_Validate_Invlid_BookPlan=" + res + "\n");

            return(res);
        }
        public async Task <bool> Testfor_New_BookPlan()
        {
            //Arrange
            var res = false;

            //Action
            service.Setup(repos => repos.BookPlan(_plan.PlanId, _customer)).ReturnsAsync(_bookedPlan);
            var result = await _internetServices.BookPlan(_plan.PlanId, _customer);

            //Assertion
            if (result != null)
            {
                res = true;
            }
            //final result displaying in text file
            await File.AppendAllTextAsync("../../../../output_revised.txt", "Testfor_New_BookPlan=" + res + "\n");

            return(res);
        }
        public async Task <bool> Testfor_ValidateBookedPlanId()
        {
            //Arrange
            bool res = false;

            //Act
            service.Setup(repo => repo.BookPlan(_plan.PlanId, _customer)).ReturnsAsync(_bookedPlan);
            var result = await _internetServices.BookPlan(_plan.PlanId, _customer);

            if (result.BookedPlanId == _bookedPlan.BookedPlanId)
            {
                res = true;
            }
            //Asert
            //final result displaying in text file
            await File.AppendAllTextAsync("../../../../output_boundary_revised.txt", "Testfor_ValidateBookedPlanId=" + res + "\n");

            return(res);
        }