public async Task Init_ParameterProvided_EntryIsSet()
        {
            // Arrange
            var mockEntry = new Mock <TripLogEntry>().Object;

            _vm.Entry = null;

            // Act
            await _vm.Init(mockEntry);

            // Assert
            Assert.IsNotNull(_vm.Entry, "Entry is null after being initialized with a valid TripLogEntry object");
        }
コード例 #2
0
        public ActionResult BlogDetail(string page, string id)
        {
            var data = new DetailViewModel();

            data.Init();
            return(View("BlogDetail", data));
        }
コード例 #3
0
        public async Task Init_ParameterProvided_EntryIsSet()
        {
            // Arrange
            var mockEntry = new Mock <TripLogEntry>().Object;

            _vm.Entry = null;

            // Act
            await _vm.Init(mockEntry);

            // Assert
            Assert.ThrowsAsync <EntryNotProvidedException>(async() =>
            {
                await _vm.Init();
            });
        }
コード例 #4
0
        public async Task DetailViewModelInitializationThrowsTest()
        {
            var viewModel = new DetailViewModel();

            var entry = new TripLogEntry();

            await viewModel.Init(entry);

            Assert.AreEqual(entry, viewModel.Entry);
        }
コード例 #5
0
        public void Init_ParameterNotProvided_ThrowsEntryNotProvidedException()
        {
            // Arrange
            DetailViewModel vm = GetViewModelMock();

            // Act
            Action act = () => vm.Init();

            // Assert
            act.Should().Throw <EntryNotProvidedException>();
        }
コード例 #6
0
        public void Init_ParameterProvided_EntryIsSet()
        {
            // Arrange
            DetailViewModel vm = GetViewModelMock();

            vm.Entry = null;
            TripLogEntry mockEntry = new Mock <TripLogEntry>().Object;

            // Act
            vm.Init(mockEntry);

            // Assert
            vm.Entry.Should().NotBeNull("Entry is null after being " +
                                        "initialized with a valid TripLogEntry object");
        }
        public void Init_CreatesUser_returns_NotNull_Nationality()
        {
            //Arrange
            var expected = new User()
            {
                FirstName = "test", LastName = "test", Nationality = "testland", Email = "*****@*****.**", BirthDate = DateTime.Now.AddYears(-12).Date
            };
            var detailViewModel = new DetailViewModel();

            detailViewModel.Init(expected);
            //Act
            var detailUser = detailViewModel.GetUser();

            //Assert
            Assert.NotNull(detailUser.Nationality);
        }
        public void Init_CreatesUser_returns_UserType()
        {
            //Arrange
            var user = new User()
            {
                FirstName = "test", LastName = "test", Nationality = "testland", Email = "*****@*****.**", BirthDate = DateTime.Now.AddYears(-12).Date
            };
            var detailViewModel = new DetailViewModel();

            detailViewModel.Init(user);
            //Act
            var detailUser = detailViewModel.GetUser();

            //Assert
            Assert.IsType <User>(detailUser);
        }
        public void Init_CreatesUser_compares_Date()
        {
            //Arrange
            var user = new User()
            {
                FirstName = "test", LastName = "test", Nationality = "testland", Email = "*****@*****.**", BirthDate = DateTime.Now.AddYears(-12).Date, Password = "", Role = "", Token = "", IsSpotifyDj = false
            };
            string expected        = user.BirthDate.ToShortDateString();
            var    detailViewModel = new DetailViewModel();

            detailViewModel.Init(user);
            //Act
            string actual = detailViewModel.BirthDate;

            //Assert
            Assert.Equal(expected, actual);
        }
        public void Init_CreatesUser_returns_NotNull_BirthDate()
        {
            //Arrange
            var expected = new User()
            {
                FirstName = "test", LastName = "test", Nationality = "testland", Email = "*****@*****.**", BirthDate = DateTime.Now.AddYears(-12).Date
            };
            var detailViewModel = new DetailViewModel();

            detailViewModel.Init(expected);
            //Act
            var detailUser = detailViewModel.GetUser();

            //Assert
            //Ik kreeg hiervoor een waarschuwing dus converteer ik het hier naar een string.
            Assert.NotNull(detailUser.BirthDate.ToShortDateString());
        }
コード例 #11
0
 protected override void OnAppearing()
 {
     base.OnAppearing();
     Task.Run(async() => await _vm.Init());
 }
コード例 #12
0
        public async Task DetailViewModelInitializationOkTest()
        {
            var viewModel = new DetailViewModel();

            await viewModel.Init();
        }
コード例 #13
0
        public void DetailViewModelInitializationOkTest()
        {
            var viewModel = new DetailViewModel();

            viewModel.Init();
        }