public void GetTutorial_Success_Test() { // Arrange int id = 1; R_Tutorial tutorial = SampleTutorial(id); // create mock for repository var mock = new Mock <ITutorialRepository>(); mock.Setup(s => s.GetTutorial(Moq.It.IsAny <int>())).Returns(tutorial); // service TutorialService tutorialService = new TutorialService(); TutorialService.Repository = mock.Object; // Act TutorialDTO result = tutorialService.GetTutorial(id); // Assert Assert.IsNotNull(result); Assert.AreEqual(1, result.TutorialId); }