public async void GetTripsByLineID_Exists() { var repo = new Mock <ITripRepository> (); var uow = new Mock <IUnitOfWork> (); string lineID = "Line:1"; string pathID = "Path:1"; string tripDepartureTime = "20:12:10"; LineId line = new LineId(lineID); var trip = new Trip(lineID, pathID, tripDepartureTime); var trips = new List <Trip> () { trip }; var tripDTO = new TripDTO(trip.Id.AsGuid(), new LineId(lineID), new PathId(pathID), tripDepartureTime); var tripsDTO = new List <TripDTO> () { tripDTO }; repo.Setup(_ => _.GetTripsByLineID(line)).ReturnsAsync(trips); var service = new TripService(repo.Object, uow.Object); var actual = await service.GetTripsByLineID(line); Assert.Equal(tripsDTO, actual); }
public async void GetByLineId() { var tripServiceMock = new Mock <ITripService> (); var pathServiceMock = new Mock <IPathService> (); string lineID = "Line:1"; string pathID = "Path:1"; string tripDepartureTime = "20:12:10"; var trip = new Trip(lineID, pathID, tripDepartureTime); var tripDTO = new TripDTO(trip.Id.AsGuid(), new LineId(lineID), new PathId(pathID), tripDepartureTime); var tripsDTO = new List <TripDTO> () { tripDTO }; var line = new LineId(lineID); tripServiceMock.Setup(_ => _.GetTripsByLineID(line)).ReturnsAsync(tripsDTO); var controller = new TripController(tripServiceMock.Object, pathServiceMock.Object); var actual = await controller.GetByLineId(lineID); Assert.Equal(tripsDTO, actual.Value); }
private Assign(Location loc, string builtIn, LineId line) : base(line) { this.location = loc; this.value = null; this.builtIn = builtIn; }
public Input(Expression inputPromptExpr, Block inputs, LineId line) : base(line) { this.inputPrompt = new Print( new Expression[] { inputPromptExpr, new StringLiteral("\0", line) }, line); this.inputs = inputs; }
public TripDTO(Guid Id, LineId lineID, PathId pathID, string tripDepartureTime, List <NodePassageDTO> nodePassageListDTO) { this.Id = Id; this.lineID = lineID; this.pathID = pathID; this.tripDepartureTime = tripDepartureTime; this.nodePassageListDTO = new List <NodePassageDTO> (nodePassageListDTO); }
protected RelationalExpression(Expression e1, Expression e2, bool not, LineId line) : base(line) { this.e1 = e1; this.e2 = e2; this.not = not; }
public If(Expression conditional, string label, string elseLabel, LineId line) : base(line) { jmp = new Goto(label, line); elseJmp = new Goto(elseLabel, line); this.conditional = conditional; }
public For(Assign init, Expression comparison, Assign update, Statement stmt, LineId line) : base(line) { this.init = init; this.comparison = comparison; this.stmt = stmt; this.update = update; }
public Task <List <Trip> > GetTripsByLineID(LineId otherLineID) { var query = from t in this.trips where t.lineID.id == otherLineID.id select t; return(Task.Run(() => query.ToList <Trip> ())); }
public ImportedTripDTO(string key, Guid Id, LineId lineID, PathId pathID, string tripDepartureTime) { this.key = key; this.Id = Id; this.lineID = lineID; this.pathID = pathID; this.tripDepartureTime = tripDepartureTime; this.nodePassageListDTO = new List <NodePassageDTO> (); }
public override int GetHashCode() { int hashCode = -96987508; hashCode = hashCode * -1521134295 + LineId.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(name_line); hashCode = hashCode * -1521134295 + nbr_place_line.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer <Enum> .Default.GetHashCode(typee); return(hashCode); }
public override string ToString() { var sb = new StringBuilder(); var lineId = LineId.ToList(); lineId.Insert(0, 0x00); var l = Convert.ToUInt32(lineId.ByteArrToHexStr(), 16); sb.Append($"标识位:{BitConverter.GetBytes(BeginMark).ByteArrToHexStr()},数据长度:{DataLength},版本:{Version},序列号1:{SerialNum1},序列号2:{SerialNum2},检测线状态:{Convert.ToString(WireStatus,2).PadLeft(8,'0')},状态位:{Convert.ToString(Status,2).PadLeft(8,'0')},车辆编号:{VehicleNum},时间:{GetDateTimeStr()},命令字:0x{CommandCode:X2},线路ID:{l},子线路编码:{SubLineCode},校验码:{CheckCode}.\r\n"); sb.Append(Body); return(sb.ToString()); }
public void BuildTreeNodes() { string lineShadow = ""; if (ParentLine != null) { lineShadow = ParentLine.LineShadow + "-" + LineId.ToString().PadRight(15, ' '); } else { lineShadow = LineId.ToString().PadRight(15, ' '); } this.LineShadow = lineShadow; }
public MyBudget.Commands.UpdateLine PrepareUpdateLine(string userId) { var expense = new Expense(new Amount(Currencies.Parse(CurrencyISOCode), Amount), Date, Category, Description, DistributionKey); return(new MyBudget.Commands.UpdateLine { UserId = userId, BudgetId = BudgetId.ToString(), LineId = LineId.ToString(), Id = Guid.NewGuid(), Timestamp = DateTime.Now, Expense = expense, }); }
public async Task <List <TripDTO> > GetTripsByLineID(LineId lineId) { var tripList = await this._repo.GetTripsByLineID(lineId); var tripDTOlist = new List <TripDTO> (); foreach (var trip in tripList) { TripDTO tripDTO = _mapper.DomainToDTO(trip); tripDTOlist.Add(tripDTO); } return(tripDTOlist); }
public CreateLine ToCreateLine(DateTime timestamp, BudgetId budgetId, string userId, IEnumerable <MyBudget.Projections.Category> categories) { var category = Categoria.Trim().Replace((char)160, ' '); var categoryId = categories.FirstOrDefault(d => string.Compare(d.Name, category, true) == 0).Id; var expense = new Expense(new Amount(Currencies.Euro(), Spesa), Data, categoryId, Descrizione, DistributionKey); return(new CreateLine { Id = Guid.NewGuid(), Timestamp = timestamp, BudgetId = budgetId.ToString(), LineId = LineId.Create(budgetId).ToString(), UserId = userId, Expense = expense, }); }
public static CreateLine ToCreateLine(this Movement mov, BudgetId budgetId, string userId, IEnumerable <MyBudget.Projections.Category> categories) { var category = mov.Category.Trim().Replace((char)160, ' '); var categoryId = categories.FirstOrDefault(d => string.Compare(d.Name, category, true) == 0).Id; var expense = new Expense(new Amount(Currencies.Euro(), Convert.ToDecimal(mov.Import)), mov.DateTime, categoryId, mov.ShortDescription); return(new CreateLine { Id = Guid.NewGuid(), Timestamp = DateTime.Now, BudgetId = budgetId.ToString(), LineId = LineId.Create(budgetId).ToString(), UserId = userId, Expense = expense, }); }
public async void GetTripsByLineID_Empty() { var repo = new Mock <ITripRepository> (); var uow = new Mock <IUnitOfWork> (); LineId line = new LineId("Line:2"); var expected = new List <TripDTO> () { }; repo.Setup(_ => _.GetTripsByLineID(line)).ReturnsAsync(new List <Trip> ()); var service = new TripService(repo.Object, uow.Object); var actual = await service.GetTripsByLineID(line); Assert.Equal(expected, actual); }
public TypeCheckException(string message, LineId line) : base(message, line) { }
public static RelationalExpression CompareNotEquals( Expression e1, Expression e2, LineId line) { return new Equals(e1, e2, true, line); }
public override string ToString() { return(LineId.ToString() + " " + ColumnIndex.ToString()); }
public static Assign ReadConsole(Location loc, LineId line) { return new Assign(loc, inputExpr, line); }
public Assign(Location loc, Expression value, LineId line) : base(line) { this.location = loc; this.value = value; }
public Power(Expression e1, Expression e2, LineId line) : base(e1, e2, line) { }
public Function(string name, LineId line, params Expression[] expressions) : base(line) { this.functionName = name; this.exprs = expressions; argsTypes = new BasicType[exprs.Length]; }
public Return(LineId line) : base(line) { }
public GreaterThan(Expression expr1, Expression expr2, bool not, LineId line) : base(expr1, expr2, not, line) { }
public override int GetHashCode() { return(LineId != null?LineId.GetHashCode() : 0); }
public static RelationalExpression CompareLessThan( Expression e1, Expression e2, LineId line) { return new LessThan(e1, e2, false, line); }
protected BinaryOperator(Expression e1, Expression e2, LineId line) : base(line) { this.expr1 = e1; this.expr2 = e2; }
public Equals(Expression e1, Expression e2, bool not, LineId line) : base(e1, e2, not, line) { }
public static RelationalExpression CompareLessThanEquals( Expression e1, Expression e2, LineId line) { return new GreaterThan(e1, e2, true, line); }
Label lineLabel; // A .NET label used to mark this location. #endregion Fields #region Constructors protected Statement(LineId line) : base(line) { }
public LocationReference(Location loc, LineId line) : base(line) { this.location = loc; }
public End(LineId line) : base(line) { }
public OnGoto(Expression number, List<string> targets, LineId line) : base(line) { this.numericExpression = number; this.targets = targets; }
public Negative(Expression value, LineId line) : base(line) { this.value = value; }
public Concatenate(Expression s1, Expression s2, LineId line) : base(line) { this.s1 = s1; this.s2 = s2; }
Label returnLabel; // This is the Label the subroutine should return to. #endregion Fields #region Constructors public Gosub(string destLabel, LineId line) : base(line) { this.destLabel = destLabel; }
public Subtract(Expression e1, Expression e2, LineId line) : base(e1, e2, line) { }
public Goto(string label, LineId line) : base(line) { this.destLabel = label; }
public static Assign ReadData(Location loc, LineId line) { return new Assign(loc, readExpr, line); }
public TypeCheckException(string message, LineId line, Exception innerException) : base(message, line, innerException) { }
protected Expression(LineId line) : base(line) { }
public Add(Expression e1, Expression e2, LineId line) : base(e1, e2, line) { }