public void Setup() { serviceClient = new Mock <ITreasureHuntService>(); viewModel = new SearchHuntViewModel(serviceClient.Object); myFakeHunt1 = new hunt(); myFakeHunt1.HuntName = "My Fake Hunt 1"; myFakeHunt2 = new hunt(); myFakeHunt2.HuntName = "My Fake Hunt 2"; returnedHunts.Add(myFakeHunt1); returnedHunts.Add(myFakeHunt2); }
public void Setup() { serviceClient = new Mock <ITreasureHuntService>(); hunt newHunt = new hunt(); newHunt.HuntId = 1; newHunt.HuntName = "New hunt"; newHunt.HuntDescription = "Hunt description"; List <hunt> listOfHunts = new List <hunt>(); listOfHunts.Add(newHunt); serviceClient.Setup(s => s.GetTreasureHuntsForParticularUserAsync(It.IsAny <user>())) .Returns(Task.FromResult(listOfHunts.ToArray())); viewModel = new SearchHuntViewModel(serviceClient.Object); user fakeUser = new user(); fakeUser.Name = "Current users name"; fakeUser.UserId = 1; fakeUser.Password = "******"; CurrentUser = fakeUser; myFakeHunt1 = new hunt(); myFakeHunt1.HuntName = "My Fake Hunt 1"; myFakeHunt2 = new hunt(); myFakeHunt2.HuntName = "My Fake Hunt 2"; returnedHunts.Add(myFakeHunt1); returnedHunts.Add(myFakeHunt2); }