示例#1
0
        public LastView()
        {
            InitializeComponent();
            var viewModel = new LatestViewModel();

            this.DataBindings.Add("Text", viewModel, nameof(viewModel.MeasureDate));
            this.MeasureViewLabel.DataBindings.Add("Text", viewModel, nameof(viewModel.MeasureValue));
        }
示例#2
0
        public void 直近値_シナリオ()
        {
            var measureMock = new Moq.Mock <IMeasureRepository>();

            measureMock.Setup(x => x.GetLatest()).Returns(new MeasureEntity("guidA", new MeasureDate("2017/01/01 13:00:00".ToDate()), new MeasureValue(1.23456f)));
            var viewModel = new LatestViewModel(measureMock.Object);

            Assert.AreEqual(viewModel.MeasureDate, "2017/01/01 13:00:00");
            Assert.AreEqual(viewModel.MeasureValue, "1.23m/s");
        }
示例#3
0
        public ActionResult Index()
        {
            LatestViewModel latest = new LatestViewModel();

            latest.LatestAlbums  = db.Albums.OrderByDescending(s => s.CreatedDate).Take(10).ToList();
            latest.LatestArtists = db.Artists.OrderByDescending(s => s.CreatedDate).Take(10).ToList();
            latest.LatestSongs   = db.Songs.OrderByDescending(s => s.CreatedDate).Take(10).ToList();


            return(View(latest));
        }
        public void Test_直近値_シナリオ()
        {
            var measureMock = new Mock <IMeasureRepository>();
            var measure     = new MeasureEntity("guidA", "2017/01/01 13:00:00".ToDate(), 1.23456f);

            measureMock.Setup(x => x.GetLatest()).Returns(measure);

            var viewModel = new LatestViewModel(measureMock.Object);

            viewModel.MeasureDate.Is("2017/01/01 13:00:00");
            viewModel.MeasureValue.Is("1.23m/s");
        }
示例#5
0
        public void シナリオ()
        {
            var entity      = new MeasureEntity(1, Convert.ToDateTime("2012/12/12 12:34:56"), 12.341f);
            var measureMock = new Mock <IMeasureRepository>();
            var vm          = new LatestViewModel(measureMock.Object);

            measureMock.Setup(x => x.GetLatest()).Returns(entity);
            vm.Search();
            vm.AreaIDText.Is("0001");
            vm.MeasureDateText.Is("2012/12/12 12:34:56");
            vm.MeasureValueText.Is("12.34℃");
        }
示例#6
0
        public IActionResult Latest()
        {
            ViewData["Title"] = "Najnowsze hasła";

            var entries = _repo.GetLatestEntries();

            if (entries != null && entries.Count > 0)
            {
                var vm = new LatestViewModel()
                {
                    Entries  = entries,
                    ShowEdit = IsAdminUser
                };
                return(View(vm));
            }
            else
            {
                return(Content("Hmmm... wcale nie ma haseł... :-("));
            }
        }
示例#7
0
        // GET: Home
        public ActionResult Index()
        {
            LatestViewModel latestContent = null;

            using (program_phstudiosEntities ctx = new program_phstudiosEntities())
            {
                List <LatestVideo> latestVideos =
                    ctx.LatestVideos.OrderByDescending(v => v.ReleaseDate).ThenByDescending(v => v.Order).Take(6).ToList();

                List <LatestProject> latestProjects =
                    ctx.LatestProjects.OrderByDescending(p => p.Created).Take(3).ToList();

                latestContent = new LatestViewModel
                {
                    LatestVideos   = latestVideos,
                    LatestProjects = latestProjects
                };
            }

            return(View(latestContent));
        }
        public void シナリオ()
        {
            // モックのデータを作成
            var entity = new MeasureEntity(
                1,
                Convert.ToDateTime("2020/05/26 22:00:00"),
                12.34f);

            // Moqセット
            var measureMock = new Mock <IMeasureRepository>();

            measureMock.Setup(x => x.GetLatest()).Returns(entity);

            var vm = new LatestViewModel(measureMock.Object);

            // エリアID
            // 計測日時
            // 計測値

            vm.Search();
            vm.AreaIdText.Is("001");
            vm.MeasureDateText.Is("2020/05/26 22:00:00");
            vm.MeasureValueText.Is("12.34℃");
        }