public void AssertThat_FloorSpec_SelectsSingleItem_FromSingleChoice() { FloorSpec spec = new FloorSpec(new[] { new KeyValuePair <float, KeyValuePair <string, string>[]>(1, new [] { new KeyValuePair <string, string>("key", "tag") }) }, new NormallyDistributedValue(1, 2, 3, 1).Transform(vary: false)); var selected = spec.Select(() => 0.5, new NamedBoxCollection(), (a, b) => ScriptReferenceFactory.Create(typeof(TestScript), Guid.NewGuid(), string.Join(",", a.Select(t => t.Value)))); Assert.AreEqual(1, selected.Count()); Assert.AreEqual("tag", selected.Single().Selection.Single().Script.Name); }
public void AssertThat_FloorSpec_SelectsNothing_FromNull() { FloorSpec spec = new FloorSpec(new[] { new KeyValuePair <float, KeyValuePair <string, string>[]>(1, null) }, new NormallyDistributedValue(1, 2, 3, 1).Transform(vary: false)); var selected = spec.Select(() => 0.5, new NamedBoxCollection(), (a, b) => ScriptReferenceFactory.Create(typeof(TestScript), Guid.NewGuid(), string.Join(",", a))); var floors = selected.SelectMany(a => a.Selection); Assert.AreEqual(0, floors.Count()); }
public static bool CreateFloor(this IRepository <IDbProperties> repository, FloorSpec spec) { var floor = spec; var dataTypes = new List <IDataTypes> { new DataTypes("@hostel", SqlDbType.NVarChar, 50, spec.HostelId, ParameterDirection.Input, false, false, ""), new DataTypes("@tag", SqlDbType.NVarChar, 50, floor.Tag, ParameterDirection.Input, false, false, ""), new DataTypes("@floor", SqlDbType.UniqueIdentifier, 0, string.Empty, ParameterDirection.Output, false, false, "@floor") }; var repos = new DbProperties("CreateFloor", dataTypes, string.Empty, true, "@floor"); var x = repository.Update(new[] { repos }); if (x > 0 || !string.IsNullOrWhiteSpace(repos.Id)) { spec.FloorId = repos.Id; return(true); } return(false); }
public FloorState(FloorSpec spec) { FloorSpec = spec; }
public CreateFloor(FloorSpec floor, string commander, string commandid) { Floor = floor; Commander = commander; CommandId = commandid; }
public CreateFloor(FloorSpec floor) { Floor = floor; }
public FloorState(FloorSpec spec, ImmutableDictionary <string, ICommand> pendingCommands, ImmutableHashSet <IMassTransitEvent> pendingResponses) { FloorSpec = spec; PendingCommands = pendingCommands; PendingResponses = pendingResponses; }
public FloorState(FloorSpec spec) : this(spec, ImmutableDictionary <string, ICommand> .Empty, ImmutableHashSet <IMassTransitEvent> .Empty) { }