public static SpecRecord CreateRecordFromSpec(ISpec spec) { string json_text = JsonConvert.SerializeObject(spec); var record = new SpecRecord(spec, json_text); return(record); }
public void CreateContainerElements(ISpec spec) { var specElement = new SpecElement(_provider, spec, _project); _consumer(specElement); var exampleContainers = spec.ExampleContainers; CreateContainerElements(exampleContainers, specElement); }
public SpecRecord(ISpec spec, string json_text) { JsonText = json_text; SpecType = spec.SpecType; TimeStamp = DateTime.Now; MaterialId = spec.MaterialId; }
public static IQueryable <TEntity> GetQuery(IQueryable <TEntity> inputQuery, ISpec <TEntity> spec) { var query = inputQuery; if (spec.Criteria != null) { query = query.Where(spec.Criteria); } if (spec.OrderBy != null) { query = query.OrderBy(spec.OrderBy); } if (spec.OrderByDescending != null) { query = query.OrderByDescending(spec.OrderByDescending); } if (spec.IsPagingEnabled) { query = query.Skip(spec.Skip).Take(spec.Take); } query = spec.Includes.Aggregate(query, (current, include) => current.Include(include)); return(query); }
public WarpingSpecification(string materialId, StyleSpecification styleSpec) { // TODO: build spec from a material_id and a style spec only this.MaterialId = materialId; this.ParentSpec = styleSpec; this.SetDefaultProperties(); }
public IEnumerable<VerizonRecord> GetFriendsAndFamilyRecommendations(ISpec<VerizonRecord> spec) { return Records .GroupBy(r => r.Number) .Select(g => CreateRecordFromGrouping(g)) .Where(spec.IsSatisfied) .OrderByDescending(r => r.Minutes) .Take(10); }
public SpecElement(IUnitTestProvider provider, ISpec spec, IProject project) : base(provider, spec, project, null) { _spec = spec; _project = project; var type = _spec.GetType(); Id = type.FullName; AssemblyLocation = type.Assembly.Location; }
public static object GetWrapperForTargetType(Type type, ITestResultListener listener, ISpec spec) { foreach (var source in GetAssemblies(type)) { var wrappedListenerType = source.GetType(typeof(ListenerWrapper).FullName); if (wrappedListenerType != null) return Activator.CreateInstance(wrappedListenerType, listener, new ExampleTranslator(spec)); } return null; }
public IEnumerable <Item> Find(ISpec <Item, bool> spec) { var result = _dbSet .Include(i => i.Subcategory) .Include(i => i.Subcategory.Category) .Where(spec.ToExpression()) .OrderBy(x => x.Name) .AsNoTracking(); return(result); }
public IEnumerable <Item> Find(ISpec <Item, bool> spec, ISpec <Item, object> orderSpec) { var result = _dbSet .Include(i => i.Subcategory) .Include(i => i.Subcategory.Category) .Include(i => i.Payment) .Where(spec.ToExpression()) .OrderBy(orderSpec.ToExpression()) .AsNoTracking() .AsEnumerable(); return(result); }
public IEnumerable <Item> GetLatestAddedItems(ISpec <Item, bool> spec, int amount) { var result = _dbSet .Include(i => i.Subcategory) .Include(i => i.Subcategory.Category) .Include(i => i.Payment) .Where(spec.ToExpression()) .OrderBy(x => x.Name) .Take(amount) .AsNoTracking(); return(result); }
public static IQueryable <TEntity> GetQuery(IQueryable <TEntity> inputQuery, ISpec <TEntity> spec) { var query = inputQuery; if (spec.Criteria != null) { query = query.Where(spec.Criteria); // t => t.ServiceTypeIf == id } query = spec.Includes.Aggregate(query, (current, include) => current.Include(include)); return(query); }
public static ObjectSpecs NewSingleSpec(ISpec spec, Type objType) { string getError(object obj) { return($"Type mismatched, got: {obj.GetType()}, expected: {objType}."); } var specs = new Specs(); specs.AddSpec(spec); object?deserializeValue = null; object?serializeValue = null; return(new ObjectSpecs( specs, (_, _) => null, (_, v) => { if (v != null && !objType.IsInstanceOfType(v)) { throw new InvalidOperationException(getError(v)); } deserializeValue = v; }, (_, _) => deserializeValue, (_, obj) => { if (obj != null && !objType.IsInstanceOfType(obj)) { throw new InvalidOperationException(getError(obj)); } serializeValue = obj; }, _ => serializeValue, (_, _) => { })); }
/// <summary> /// Merge 2 floorplan tags togehter /// </summary> /// <param name="a"></param> /// <param name="b"></param> /// <returns></returns> private static FloorplanFaceTag MergeTags(FloorplanFaceTag a, FloorplanFaceTag b) { Contract.Requires(a != null && a.Mergeable); Contract.Requires(b != null && b.Mergeable); //Choose the non null spec (if either are not null) ISpec spec = null; if (a.Spec != null ^ b.Spec != null) { spec = a.Spec ?? b.Spec; } else if (a.Spec != null && b.Spec != null) { throw new NotImplementedException("Both faces in merge already have a spec assigned"); } return(new FloorplanFaceTag( true, //A and B must be mergeable (see contract) so therefore this must be mergeable spec )); }
public SpecController(IUnityContainer container, ISpec spec) { _container = container; Spec = spec; }
public static ISpec <WeatherForecast> WithNotTemperature(this ISpec <WeatherForecast> spec, int temperature) => spec.And(x => x.TemperatureC != temperature);
public void TestMessageWithExtendedOption(ISpec Spec)
private object?_DeserializeMultiValue(ISpec spec, List <string> values) { return(spec.CanHandleType(spec.ObjType) ? spec.DeserializeMultiValue(this, spec.ObjType, values) : mValueSerializer.DeserializeMultiValue(this, spec.ObjType, values)); }
private object?_DeserializeNonValue(ISpec spec, bool matched) { return(spec.CanHandleType(spec.ObjType) ? spec.DeserializeNonValue(this, spec.ObjType, matched) : mValueSerializer.DeserializeNonValue(this, spec.ObjType, matched)); }
public RepeatSpec(string id, IValueGenerator count, ISpec space) : base(id) { Count = count; Space = space; }
public static ICommunicator CreateCommunicator(Int32 port, Int32 transferBlockSize, ISpec spec) { CoapConfig config = new CoapConfig(); config.Port = port; config.TransferBlockSize = transferBlockSize; config.Spec = spec; return(CreateCommunicator(config)); }
public LocalEndPoint(ISpec spec) : this(CommunicatorFactory.CreateCommunicator(spec.DefaultPort, spec.DefaultBlockSize, spec)) { }
public ISpecComponentBuilder <TInput> WithGuard(ISpec <TInput> spec) => this.WithGuard(_ => spec);
public IEnumerable<VerizonRecord> GroupByNumber(ISpec<VerizonRecord> spec) { return Records .Where(spec.IsSatisfied) .GroupBy(r => r.Number) .Select(g => CreateRecordFromGrouping(g)) .OrderByDescending(r => r.Minutes); }
public static ISpec <WeatherForecast> WithId(this ISpec <WeatherForecast> spec, long id) => spec.And(x => x.WeatherForecastId == id);
public void TestMessageWithOptions(ISpec Spec)
public void TestResponseParsing(ISpec Spec)
public BickleUnitTestElement(IUnitTestProvider provider, ISpec spec, IProject project, UnitTestElement parent) : base(provider, parent) { _spec = spec; _project = project; }
public IEnumerable <Course> List2(ISpec <Course> spec) { return(_courses .Where(spec.CriteriaExpression) .AsEnumerable()); }
public void TestMessage(ISpec Spec)
public static void PushSpec(ISpec spec) { var record = Factory.CreateRecordFromSpec(spec); // TODO: Create sql to load into table: modified_specificiations }
public void TestRequestParsing(ISpec Spec)
private object?_DeserializeSingleValue(ISpec spec, string?value) { return(spec.CanHandleType(spec.ObjType) ? spec.DeserializeSingleValue(this, spec.ObjType, value) : mValueSerializer.DeserializeSingleValue(this, spec.ObjType, value)); }
public ExampleContainerWrapper(object inner, ISpec spec) { _inner = inner; ContainingSpec = spec; }
public static IEndPoint CreateEndPoint(ISpec spec) { CoapConfig config = new CoapConfig(); config.DefaultPort = spec.DefaultPort; config.Spec = spec; CoAPEndPoint ep = new CoAPEndPoint(config); ep.Start(); return ep; }
public StyleSpecification(string style) { // There is an element type of specification this.ParentSpec = null; this.Style = style; }
public List<Product> SelectBy(ISpec spec) { var products = productRepository.GetAllProducts(); return products.Where(spec.IsSatisfiedBy).ToList(); }
public bool TryGetMember(ISpec spec, out MemberInfo memberInfo) { Init(); return(mSpec2MemberInfo.TryGetValue(spec, out memberInfo)); }
public NotSpec(ISpec spec) { _spec = spec; }
public ExampleWrapper(object o, ISpec spec) { _inner = o; _spec = spec; }
public ExampleTranslator(ISpec spec) { _spec = spec; }
public FloorplanFaceTag(bool mergeable, ISpec spec = null) { Mergeable = mergeable; Spec = spec; }