Example #1
0
 public void AddStudentWithParameters(StudentCreator student)
 {
     new StudentSteps().CreateStudent(student);
     Student expectedStudent = Transformations.GetStudentBasedOnStudentCreator(student);
     ScenarioContext.Set(expectedStudent, ExpectedStudent);
     Logger.Info($"\nStudent created with the following properties. " +
         $"{PropertiesDescriber.GetObjectProperties(expectedStudent)}");
 }
Example #2
0
        public void AddAppointmentWithParameters(AppointmentCreator appointment)
        {
            new AppointmentSteps().CreateAppointment(appointment);
            Appointment expectedAppointment = Transformations.GetAppointmentBasedOnAppointmentCreator(appointment);

            ScenarioContext.Set(expectedAppointment, ExpectedAppointment);
            Logger.Info($"\nAppointment created with the following properties. " +
                        $"{PropertiesDescriber.GetObjectProperties(expectedAppointment)}");
        }
Example #3
0
        public void AddDebtWithParameters(DebtCreator debt)
        {
            new DebtSteps().CreateDebt(debt);
            Debt expectedDebt = Transformations.GetDebtBasedOnDebtCreator(debt);

            ScenarioContext.Set(expectedDebt, ExpectedDebt);
            Logger.Info($"\nDebt created with the following properties. " +
                        $"{PropertiesDescriber.GetObjectProperties(expectedDebt)}");
        }
Example #4
0
        public void AddCollectorWithParameters(CollectorCreator collector)
        {
            new CollectorSteps().CreateCollector(collector);
            Collector expectedCollector = Transformations.GetCollectorBasedOnCollectorCreator(collector);

            ScenarioContext.Set(expectedCollector, ExpectedCollector);
            Logger.Info($"\nCollector created with the following properties. " +
                        $"{PropertiesDescriber.GetObjectProperties(expectedCollector)}");
        }
Example #5
0
        public void FindCollectorByParameters(CollectorCreator expectedCollector)
        {
            int countOfObjects = new CollectorSteps().GetListOfCollectors()
                                 .Count(collector => collector.fearFactor.Equals(expectedCollector.fearFactor) &&
                                        collector.nickname.Equals(expectedCollector.nickname));

            Assert.AreEqual(1, countOfObjects,
                            $"There should be only one collector with the following properties. Actual count of such collectors is {countOfObjects}." +
                            $"{PropertiesDescriber.GetObjectProperties(expectedCollector)}");
        }
Example #6
0
 public void FindStudentByParameters(StudentCreator expectedStudent)
 {
     int countOfObjects = new StudentSteps().GetListOfStudents()
         .Count(student => student.name.Equals(expectedStudent.name)
         && student.age.Equals(expectedStudent.age)
         && student.sex.Equals(expectedStudent.sex)
         && student.risk.Equals(expectedStudent.risk));
     Assert.AreEqual(1, countOfObjects,
         $"There should be only one student with the following properties. Actual count of such students is {countOfObjects}." +
         $"{PropertiesDescriber.GetObjectProperties(expectedStudent)}");
 }
Example #7
0
        private IRestResponse ExecuteRequest(Method method, HttpStatusCode expectedStatusCode, object body = null, string objectId = "")
        {
            var         resourceUrl = $"{Resource}/{objectId}";
            RestRequest restRequest = new RestRequest(resourceUrl, method);

            restRequest.RequestFormat = DataFormat.Json;
            Logger.Debug($"\nTrying send a request for url {BaseUrl}{resourceUrl}." +
                         $"\nMethod: {method}");
            if (body != null)
            {
                restRequest.AddJsonBody(body);
                Logger.Debug($"\nBody: {PropertiesDescriber.GetObjectProperties(body)}");
            }
            IRestResponse response = RestClient.Execute(restRequest);

            if (expectedStatusCode != 0)
            {
                CheckHttpStatusCode(response, expectedStatusCode);
            }
            Logger.Debug($"\nResponse status code: {response.StatusCode}");
            return(response);
        }