public void Get_GuidId() { var settingMock = new Mock<ISettings>(); var componentMock = new Mock<IComponents>(); var uowMock = new Mock<IUnitOfWork>(); var repositoryMock = new Mock<IRepository>(); var serviceLocatorMock = new Mock<IServiceLocator>(); serviceLocatorMock.Setup(r => r.GetInstance<IRepository>()) .Returns(repositoryMock.Object); ServiceLocator.SetLocatorProvider(() => serviceLocatorMock.Object); Guid id = Guid.NewGuid(); repositoryMock.Setup(r => r.FindById<Call>(id)).Returns(new Call()); // Act CallService callService = new CallService(uowMock.Object, repositoryMock.Object, settingMock.Object, componentMock.Object); callService.Get(id); // Assert repositoryMock.Verify(r => r.FindById<Call>(id)); }