public void Dialog_Details() { Dialog d1 = new Dialog { Id = 1 }; Dialog d2 = new Dialog { Id = 2 }; Mock <IDialogService> mock = new Mock <IDialogService>(); mock.Setup(m => m.GetDialogAsync(2)).ReturnsAsync(new Dialog { Id = 2 }); DialogController controller = new DialogController(mock.Object, null); //Arrange //Act var result = ((controller.Details(2).Result).Model) as DetailsDialogViewModel; //Assert Assert.AreEqual(result.Id, 2); }