public void GetShareIDTest() { // Arrange var shareRepositoryMock = Substitute.For <ISharesRepository>(); var sut = new SharesService(shareRepositoryMock); string shareType = "Nissan"; shareRepositoryMock .DoesShareExists(Arg.Is <string>(shareType)) .Returns(true); // Act sut.GetShareIDByType(shareType); // Asserts shareRepositoryMock.Received(1).GetShareIDByType(Arg.Is <string>(shareType)); }