示例#1
0
        protected int GetNeededId(string id, SdcaParts part)
        {
            int neededId;

            if (id.Equals("last"))
            {
                neededId = part switch
                {
                    SdcaParts.collector => new CollectorSteps().LastCollectorId,
                    SdcaParts.appointment => new AppointmentSteps().LastAppointmentId,
                    SdcaParts.debt => new DebtSteps().LastDebtId,
                    SdcaParts.student => new StudentSteps().LastStudentId,
                    _ => throw new NotImplementedException($"The GetNeededId method has no implementation for '{part}' object")
                };
            }
            else if (id.Equals("this"))
            {
                neededId = ScenarioContext.Get <int>("NeededId");
            }
            else
            {
                neededId = int.Parse(id);
            }
            return(neededId);
        }
示例#2
0
        public void ThenDebtWithIdIsConnectedWithFollowingObject(string id, SdcaParts sdcaPart, Table table)
        {
            int    neededId       = GetNeededId(id, SdcaParts.debt);
            object expectedObject = sdcaPart switch
            {
                SdcaParts.student => Transformations.GetStudentBasedOnStudentCreator(StepArgumentTransformations.GetStudentCreator(table)),
                _ => null
            };
            object actualObject = sdcaPart switch
            {
                SdcaParts.student => new StudentSteps().GetStudentById(new DebtSteps().GetDebtById(neededId).studentId),
                _ => null
            };

            Assert.AreEqual(expectedObject, actualObject,
                            PropertiesDescriber.GetActualAndExpectedObjectsProperties(expectedObject, actualObject));
        }
示例#3
0
        public void ThenAppointmentDataWithIdIsConnectedWithFollowingObject(string id, SdcaParts sdcaPart, Table table)
        {
            int    neededId       = GetNeededId(id, SdcaParts.appointment);
            object expectedObject = sdcaPart switch
            {
                SdcaParts.debt => Transformations.GetDebtBasedOnDebtCreator(StepArgumentTransformations.GetDebtCreator(table)),
                SdcaParts.collector => Transformations.GetCollectorBasedOnCollectorCreator(StepArgumentTransformations.GetCollectorCreator(table)),
                _ => null
            };
            Appointment appointment  = new AppointmentSteps().GetAppointmentById(neededId);
            object      actualObject = sdcaPart switch
            {
                SdcaParts.debt => new DebtSteps().GetDebtById(appointment.debtId),
                SdcaParts.collector => new CollectorSteps().GetCollectorById(appointment.collectorIds[0]),
                _ => null
            };

            Assert.AreEqual(expectedObject, actualObject,
                            PropertiesDescriber.GetActualAndExpectedObjectsProperties(expectedObject, actualObject));
        }