/// <summary> /// Creates a new mapped huge array. /// </summary> /// <param name="baseArray">The base array.</param> /// <param name="elementSize">The size of one mapped structure when translate to the simpler structure.</param> /// <param name="mapTo">The map to implementation.</param> /// <param name="mapFrom">The map from implementation.</param> public MappedHugeArray(HugeArrayBase <T> baseArray, int elementSize, MapTo mapTo, MapFrom mapFrom) { _baseArray = baseArray; _elementSize = elementSize; _mapTo = mapTo; _mapFrom = mapFrom; }
public void GlobalSetup() => mapFrom = new MapFrom { BooleanFrom = random.NextDouble() > 0.5D, DateTimeOffsetFrom = DateTimeOffset.UtcNow, IntegerFrom = random.Next(), LongFrom = random.Next(), StringFrom = random.Next().ToString() };
public void GlobalSetup() => this.mapFrom = new MapFrom() { BooleanFrom = this.random.NextDouble() > 0.5D, DateTimeOffsetFrom = DateTimeOffset.UtcNow, IntegerFrom = this.random.Next(), LongFrom = this.random.Next(), StringFrom = this.random.Next().ToString(CultureInfo.InvariantCulture) };
public void MapNull_ToNull_Mapped() { MapFrom from = null; var mapper = new Mapper(); var to = mapper.Map(from); Assert.Null(to); }
protected override void Because_of() { var source = new MapFrom { Element = new MapFromElementDerived { Prop = "PROP1", Prop2 = "PROP2" } }; _destination = Mapper.Map <MapTo>(source); }
private void okbtn_Click(object sender, EventArgs e) { try { MapFrom.blockColCount = int.Parse(this.textBox1.Text); MapFrom.blockRowCount = int.Parse(this.textBox2.Text); this.Hide(); MapFrom mapfrom = this.Owner as MapFrom; mapfrom.setTabelGrid(); } catch (Exception ex) { MessageBox.Show(this, ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public void GlobalSetup() { _mapFrom = new MapFrom[100]; for (var i = 0; i < _mapFrom.Length; ++i) { _mapFrom[i] = new MapFrom() { BooleanFrom = _random.NextDouble() > 0.5D, DateTimeOffsetFrom = DateTimeOffset.UtcNow, IntegerFrom = _random.Next(), LongFrom = _random.Next(), StringFrom = _random.Next().ToString() }; } }
/// <summary> /// Returns an implementation of the given interface with properties populated from the specified source or config section. /// </summary> /// <param name="mapfrom">The config mapping source</param> public static T Map <T>(MapFrom mapfrom) { switch (mapfrom) { case MapFrom.AppSettings: return(Lookup <T, AppSettings>()); case MapFrom.ConnectionStrings: return(Lookup <T, ConnectionStrings>()); case MapFrom.EnvironmentVariables: return(Lookup <T, EnvironmentVariables>()); default: throw new ArgumentOutOfRangeException("mapfrom"); } }
protected override void Because_of() { var source = new MapFrom { Element = new MapFromElementDerived { Prop = "PROP1", Prop2 = "PROP2" } }; _destination = Mapper.Map<MapTo>(source); }
public void Test() { var refs = "blah v nope v krrrumpt"; var l = "len(refs)"; var z = @" case refs blah: whoomp v schnoo nope: plops "; // z = plops v whoomp v schnoo v nil // // but the relations we've added don't predeterminethis; we need to rediscover this obvious fact // // z has a case relation // vars have to be taken as nil by default // otherwise the above relation is not enough to sample // // but we'd look at node z, and it would have an edge leading to the case relation // z begins as any // // and it actually has four relations: whoomp, schnoo, plops and never // whoomp and schnoo sit beside each other as possibles // (whoomp v schnoo) v plops // // its a structure of nested disjunctions // // Assert(z == plops v (whoomp v schnoo)) // Assert((z==plops) v ((z==whoomp) v (z==schnoo))) // // the above assertion would create graph links either one per linked var // each variable is itself just a named expression // // z means: plops v (whoomp v schnoo) // // and, as more things are pinned to it, // the name/expression comes to mean more and more // // Assert(x==1) // Assert(x==2) // accumulates this: x = 1 ^ 2 = never // // // so how do we accumulate ors? into an alternate realilty of assertions // we can pile up assertions in one block; but then me must yield // //true //^ Assert(x==this) //v Assert(x==that) // // i dunno - we seem to want to be able to piile on constraints later // //true //^ Assert(x==this) //^ Assert(x==that) //^ Assert(x==another) // //which is basically building one big expression //of lots of nested relations //which we then need to search // //exceptit also involves binds //binds in two lobes joined by an AND become joined by ANDs, and ORs similarly //so in my simple language, i need ands and ors, but also binds //exp: // const //| var = exp //| exp ^ exp //| exp v exp // //const: // //var: // \w+ // //though i can start with the actual ast in C#... var xx = @" "; var custRefs = Set("C1", "C2", "C3"); var keys = MapFrom(custRefs, ("C1", "KEY1"), ("C2", "KEY2"), ("C3", "KEY3") ); var serviceRefs = Set("123", "234", "345"); }