示例#1
0
        public async Task <bool> Testfor_Validate_Invlid_Complaint()
        {
            //Arrange
            bool res = false;
            var  _complaintUpdate = new Complaint
            {
                ComplaintId = 1,
                Subject     = "Not Working",
                Description = "Internet Plan is not working",
                CustomerId  = 1,
                Email       = "*****@*****.**",
                IsSolved    = false
            };

            _complaintUpdate = null;
            //Act
            service.Setup(repo => repo.RegisterComplaint(_complaintUpdate)).ReturnsAsync(_complaintUpdate = null);
            var result = await _internetServices.RegisterComplaint(_complaintUpdate);

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

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

            //Act
            service.Setup(repo => repo.RegisterComplaint(_complaint)).ReturnsAsync(_complaint);
            var result = await _internetServices.RegisterComplaint(_complaint);

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

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

            //Action
            service.Setup(repos => repos.RegisterComplaint(_complaint)).ReturnsAsync(_complaint);
            var result = await _internetServices.RegisterComplaint(_complaint);

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

            return(res);
        }