コード例 #1
0
        public void Setup()
        {
            _receiver      = Substitute.For <ITransponderReceiver>();
            _monitoredArea = Substitute.For <IMonitoredArea>();
            _parser        = Substitute.For <IParseTrackInfo>();
            _flightHandler = Substitute.For <IFlightExtractor>();
            _formatter     = Substitute.For <ITimestampFormatter>();

            _position = Substitute.For <IPosition>();

            _uut = new TrackObjectifier(
                _receiver,
                _monitoredArea,
                _parser,
                _flightHandler,
                _formatter);

            _argList = new List <string> {
                "ATR423;39045;12932;14000;20151006213456789"
            };
            _args = new RawTransponderDataEventArgs(_argList);

            _uut.TrackListReady += (sender, updatedArgs) =>
            {
                _trackList = updatedArgs.TrackList;
            };
        }
コード例 #2
0
 public CommentsController(IDbContext dbContext, UserManager <ApplicationUser> userManager, ICommentCreater commentCreater, ITimestampFormatter timestampFormatter)
 {
     this.dbContext          = dbContext;
     this.userManager        = userManager;
     this.commentCreater     = commentCreater;
     this.timestampFormatter = timestampFormatter;
 }
コード例 #3
0
ファイル: IT10_ListHandler.cs プロジェクト: FatimaAU/HandIn3
        public void Setup()
        {
            _listHandler   = Substitute.For <IListHandler>();
            _monitoredArea = new MonitoredArea(90000, 10000, 20000, 500);

            _transponderReceiver = Substitute.For <ITransponderReceiver>();
            _flightExtractor     = new FlightExtractor();
            _parseTrackInfo      = new ParseTrackInfo();
            _timestampFormatter  = new TimestampFormatter();

            _trackObjectifier = new TrackObjectifier(_transponderReceiver, _monitoredArea, _parseTrackInfo, _flightExtractor, _timestampFormatter);

            ATM = new ATMSystem(_trackObjectifier, _listHandler);

            _argList = new List <string>
            {
                "ATR423;39045;12932;14000;20151006213456789",
                "DSD323;40000;12930;15000;20151006213456789"
            };

            _args = new RawTransponderDataEventArgs(_argList);

            _trackObjectifier.TrackListReady += (sender, updatedArgs) =>
            {
                _trackList = updatedArgs.TrackList;
            };
        }
コード例 #4
0
        public TrackObjectifier(
            ITransponderReceiver rec,
            IMonitoredArea monitoredArea,
            IParseTrackInfo parser,
            IFlightExtractor flightHandler,
            ITimestampFormatter formatter)
        {
            rec.TransponderDataReady += CreateTrack;

            _monitoredArea = monitoredArea;
            _parser        = parser;
            _flightHandler = flightHandler;
            _formatter     = formatter;
        }
コード例 #5
0
        public void Setup()
        {
            _monitoredArea = Substitute.For <IMonitoredArea>();

            _transponderReceiver = Substitute.For <ITransponderReceiver>();
            _flightExtractor     = new FlightExtractor();
            _parseTrackInfo      = new ParseTrackInfo();
            _timestampFormatter  = Substitute.For <ITimestampFormatter>();

            _trackObjectifier = new TrackObjectifier(_transponderReceiver, _monitoredArea, _parseTrackInfo, _flightExtractor, _timestampFormatter);

            _argList = new List <string> {
                "ATR423;39045;12932;14000;20151006213456789"
            };
            _args = new RawTransponderDataEventArgs(_argList);
        }
コード例 #6
0
        public static CommentViewModel Initialize(this CommentViewModel model, Comment comment, ITimestampFormatter timestampFormatter)
        {
            model.AvatarSrc = comment.Profile.Avatar?.Id.ToString() ?? "/images/missing-square.jpg";
            model.Login     = comment.Profile.Login;
            model.Text      = comment.Text;
            model.Timestamp = timestampFormatter.Format(comment.Timestamp);

            return(model);
        }
コード例 #7
0
        public static NewsOneViewModel Initialize(this NewsOneViewModel model, News news, ITagTranslator tagTranslator, ITimestampFormatter timestampFormatter)
        {
            model.News = new OneNewsViewModel().Initialize(news, tagTranslator, timestampFormatter);

            return(model);
        }
コード例 #8
0
 public static NewsComponentViewModel Initialize(this NewsComponentViewModel model, List <News> news, ITagTranslator tagTranslator, ITimestampFormatter timestampFormatter)
 {
     return(new NewsComponentViewModel
     {
         News = news.Select(n => new OneNewsViewModel().Initialize(n, tagTranslator, timestampFormatter)).ToList()
     });
 }
コード例 #9
0
        public static OneUpdateViewModel Initialize(this OneUpdateViewModel model, Update update, ITagTranslator tagTranslator, ITimestampFormatter timestampFormatter)
        {
            model.Title     = update.Anime.Title;
            model.TitleKey  = update.Anime.Key;
            model.Tag       = tagTranslator.ToTag(update.Tag);
            model.TagInfo   = update.Tag;
            model.Timestamp = timestampFormatter.Format(update.Timestamp);
            model.ImageSrc  = update.Anime.ImageSrc;
            model.Info      = new List <DataListInformationViewModel>().Initialize(update.Infomation);

            return(model);
        }
コード例 #10
0
 public static UpdatesComponentViewModel Initialize(this UpdatesComponentViewModel model, List <Update> updates, ITagTranslator tagTranslator, ITimestampFormatter timestampFormatter)
 {
     return(new UpdatesComponentViewModel
     {
         Updates = updates.Select(u => new OneUpdateViewModel().Initialize(u, tagTranslator, timestampFormatter)).ToList()
     });
 }
コード例 #11
0
 public NewsViewComponent(IDbContext dbContext, ITimestampFormatter timestampFormatter, ITagTranslator tagTranslator)
 {
     this.dbContext          = dbContext;
     this.timestampFormatter = timestampFormatter;
     this.tagTranslator      = tagTranslator;
 }
コード例 #12
0
 public NewsController(IDbContext dbContext, ITagTranslator tagTranslator, ITimestampFormatter timestampFormatter)
 {
     this.dbContext          = dbContext;
     this.tagTranslator      = tagTranslator;
     this.timestampFormatter = timestampFormatter;
 }
コード例 #13
0
        public static OneNewsViewModel Initialize(this OneNewsViewModel model, News news, ITagTranslator tagTranslator, ITimestampFormatter timestampFormatter)
        {
            model.Key       = news.Id;
            model.Title     = news.Title;
            model.Tag       = tagTranslator.ToTag(news.Tag);
            model.TagInfo   = news.Tag;
            model.Timestamp = timestampFormatter.Format(news.Timestamp);
            model.ImageSrc  = news.ImageSrc;
            model.Text      = news.Text;

            return(model);
        }
コード例 #14
0
        public static ProfileHistoryViewModel Initialize(this ProfileHistoryViewModel model, Profile profile, ITimestampFormatter timestampFormatter)
        {
            model.UserLogin    = profile.Login;
            model.HistoryItems = profile.History
                                 .OrderByDescending(h => h.Timestamp)
                                 .Select(h => new ProfileHistoryItemViewModel().Initialize(h, timestampFormatter))
                                 .ToList();

            return(model);
        }
コード例 #15
0
 public void Setup()
 {
     _uut = new TimestampFormatter();
 }
コード例 #16
0
 public ProfileController(IDbContext dbContext, UserManager <ApplicationUser> userManager, ITimestampFormatter timestampFormatter)
 {
     this.dbContext          = dbContext;
     this.userManager        = userManager;
     this.timestampFormatter = timestampFormatter;
 }
コード例 #17
0
        public static ProfileViewModel Initialize(this ProfileViewModel model, Profile profile, ITimestampFormatter timestampFormatter)
        {
            model.Login            = profile.Login;
            model.Name             = profile.Name;
            model.AvatarId         = profile.Avatar?.Id.ToString();
            model.RegirtrationDate = profile.History.Min(h => h.Timestamp).ToLongDateString();
            model.UserAnimeLists   = profile.AnimeListSet.Select(l => new UserListInfoViewModel().Initialize(l)).ToList();
            model.UserMangaLists   = profile.MangaListSet.Select(l => new UserListInfoViewModel().Initialize(l)).ToList();
            model.History          = profile.History
                                     .OrderByDescending(h => h.Timestamp)
                                     .Take(3)
                                     .Select(h => new ProfileHistoryItemViewModel().Initialize(h, timestampFormatter))
                                     .ToList();

            return(model);
        }
コード例 #18
0
        public static ProfileHistoryItemViewModel Initialize(this ProfileHistoryItemViewModel model, ProfileHistoryItem historyItem, ITimestampFormatter timestampFormatter)
        {
            model.Text      = historyItem.Text;
            model.Timestamp = timestampFormatter.Format(historyItem.Timestamp);

            if (historyItem.Anime != null)
            {
                model.TitleInfo = new TitlePreviewPartialViewModel
                {
                    ControllerName = "Anime",
                    Title          = new TitlePreviewViewModel().Initialize(historyItem.Anime)
                }
            }
            ;
            if (historyItem.Manga != null)
            {
                model.TitleInfo = new TitlePreviewPartialViewModel
                {
                    ControllerName = "Manga",
                    Title          = new TitlePreviewViewModel().Initialize(historyItem.Manga)
                }
            }
            ;
            if (historyItem.UserList != null)
            {
                model.UserList = new UserListInfoViewModel().Initialize(historyItem.UserList);
            }

            return(model);
        }
    }
}