public ContentPage Build(ViewType modelType, TripLogEntry entry) { var viewModel = _viewModelFactory.Build(modelType); viewModel.Init(entry); var view = _viewFactory.Build(modelType, viewModel); return(view); }
public void Init() { // Arrange var expectedEntry = new TripLogEntry(); // Act testee.Init(expectedEntry); // Assert Assert.AreEqual(expectedEntry, testee.Entry); }
public void DetailSelectedFired_CallsNavigate() { // Arrange var expectedEntry = new TripLogEntry(); // Act testee.DetailSelectedItem = expectedEntry; // Assert tripLogFactoryMock.Verify(m => m.NavigateToDetailPage(expectedEntry), Times.Once); tripLogFactoryMock.Verify(m => m.NavigateToNewPage(), Times.Never); }
public DetailPage(TripLogEntry entry) { InitializeComponent(); map.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(entry.Latitude, entry.Longitude), Distance.FromMiles(.5))); map.Pins.Add(new Pin { Type = PinType.Place, Label = entry.Title, Position = new Position(entry.Latitude, entry.Longitude) }); title.Text = entry.Title; date.Text = entry.Date.ToString("M"); rating.Text = $"{entry.Rating} star rating"; notes.Text = entry.Notes; }
public async Task DeleteCommandFired_CallsDelete() { // Arrange var expectedEntry = new TripLogEntry() { Title = "Title", }; tripLogDataServiceMock.Setup(m => m.ReadAllEntriesAsync()).ReturnsAsync(new List <TripLogEntry> { expectedEntry }); await testee.Init(); // Act testee.DeleteCommand.Execute(expectedEntry); // Assert tripLogDataServiceMock.Verify(m => m.DeleteEntryAsync(expectedEntry)); Assert.AreEqual(0, testee.Entries.Count); }