public static ArgumentViewModel ToArgumentViewModel(Argument entity)
 {
     return(new ArgumentViewModel
     {
         Id = entity.Id,
         Order = entity.Order,
         Variable = VariableMapper.ToVariableViewModel(entity.Variable)
     });
 }
 public static Argument ToArgument(ArgumentViewModel model, int methodId)
 {
     return(new Argument
     {
         Id = model.Id,
         MethodId = methodId,
         VariableId = model.Variable.Id,
         Order = model.Order,
         Variable = VariableMapper.ToVariable(model.Variable)
     });
 }
Exemplo n.º 3
0
 internal static ActionViewModel ToActionViewModel(ActionEntity entity)
 {
     return(new ActionViewModel
     {
         Id = entity.Id,
         Type = entity.Type,
         Order = entity.Order,
         Variable = VariableMapper.ToVariableViewModel(entity.Variable),
         Method = MethodMapper.ToMethodViewModel(entity.Method),
         Assert = AssertMapper.ToAssertViewModel(entity.Assert)
     });
 }
Exemplo n.º 4
0
 internal static ActionEntity ToAction(ActionViewModel model, int scenarioId)
 {
     return(new ActionEntity
     {
         Id = model.Id,
         ScenarioId = scenarioId,
         VariableId = model.Variable?.Id,
         MethodId = model.Method?.Id,
         AssertId = model.Assert?.Id,
         Type = model.Type,
         Order = model.Order,
         Variable = VariableMapper.ToVariable(model.Variable),
         Method = MethodMapper.ToMethod(model.Method),
         Assert = AssertMapper.ToAssert(model.Assert)
     });
 }
        public static AssertViewModel ToAssertViewModel(Assert entity)
        {
            if (entity == null)
            {
                return(null);
            }

            return(new AssertViewModel
            {
                Id = entity.Id,
                Type = entity.Type,
                ExceptionMessage = entity.ExceptionMessage,
                ValueVariable = VariableMapper.ToVariableViewModel(entity.ValueVariable),
                ExpectedVariable = VariableMapper.ToVariableViewModel(entity.ExpectedVariable),
                DeltaVariable = VariableMapper.ToVariableViewModel(entity.DeltaVariable)
            });
        }
        public static Assert ToAssert(AssertViewModel model)
        {
            if (model == null)
            {
                return(null);
            }

            return(new Assert
            {
                Id = model.Id,
                Type = model.Type,
                ValueVariableId = model.ValueVariable.Id,
                ExpectedVariableId = model.ExpectedVariable?.Id,
                DeltaVariableId = model.DeltaVariable?.Id,
                ExceptionMessage = model.ExceptionMessage,
                ValueVariable = VariableMapper.ToVariable(model.ValueVariable),
                ExpectedVariable = VariableMapper.ToVariable(model.ExpectedVariable),
                DeltaVariable = VariableMapper.ToVariable(model.DeltaVariable),
            });
        }
        public static MethodViewModel ToMethodViewModel(Method entity)
        {
            if (entity == null)
            {
                return(null);
            }

            return(new MethodViewModel
            {
                Id = entity.Id,
                Name = entity.Name,
                TypeName = entity.TypeName,
                IsStatic = entity.IsStatic,
                IsConstructor = entity.IsConstructor,
                Variable = VariableMapper.ToVariableViewModel(entity.Variable),
                Arguments = entity.Arguments?
                            .Select(ArgumentMapper.ToArgumentViewModel)
                            .ToList()
            });
        }
        public static Method ToMethod(MethodViewModel model)
        {
            if (model == null)
            {
                return(null);
            }

            return(new Method
            {
                Id = model.Id,
                VariableId = model.Variable?.Id,
                IsStatic = model.IsStatic,
                IsConstructor = model.IsConstructor,
                TypeName = model.TypeName,
                Name = model.Name,
                Variable = VariableMapper.ToVariable(model.Variable),
                Arguments = model.Arguments?
                            .Select(x => ArgumentMapper.ToArgument(x, model.Id))
                            .ToList()
            });
        }