public void TestListPageModel() { IFeedService mockFeedService = new MockFeedService(); AutoMapper.Mapper.Initialize(cfg => cfg.CreateMap <FeedDto, Feed>()); mockFeedService.SendFeed(new FeedDto { Content = "test" }); ListPageModel pageModel = new ListPageModel(mockFeedService); pageModel.RefreshCommand.Execute(null); Assert.IsTrue(pageModel.Feeds.Count == 1); }
public async Task TestDetailsViewModel() { IFeedService mockFeedService = new MockFeedService(); var mockCoreMethods = new Mock <IPageModelCoreMethods>(); DetailsPageModel pageModel = new DetailsPageModel(mockFeedService); pageModel.CoreMethods = mockCoreMethods.Object; pageModel.NewMessage = "new message"; pageModel.SendCommand.Execute(null); Assert.IsTrue(pageModel.NewMessage == null); var feeds = await mockFeedService.GetFeeds(); Assert.IsTrue(feeds.Count == 1); }