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)
     });
 }
示例#2
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 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 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()
            });
        }