public void AddLabelShouldReturnLabel() { //Arrange var mockRepo = new Mock <INoteRepository>(); var newLabel = new Label { Content = "dotnet core", NoteId = 1 }; var resultLabel = new Label { Content = "dotnet core", LabelId = 3, NoteId = 1 }; mockRepo.Setup(repo => repo.AddLabel(newLabel)).Returns(resultLabel); var service = new NoteService(mockRepo.Object); //Act var actual = service.AddLabel(1, newLabel); //Assert Assert.IsAssignableFrom <Label>(actual); Assert.NotNull(actual); Assert.Equal("dotnet core", actual.Content); Assert.Equal(3, actual.LabelId); Assert.Equal(1, actual.NoteId); }