public void SavePassedSongRepositoryWhenIsNotNull() { var songRepositoryStub = new Mock <IEfRepository <Song> >(); // Arrange && Act GetSongForDeleteByIdQueryService sut = new GetSongForDeleteByIdQueryService( songRepository: songRepositoryStub.Object); // Assert var actualSongRepository = sut.GetType() .GetFields(BindingFlags.Instance | BindingFlags.NonPublic) .First(fi => fi.FieldType == typeof(IEfRepository <Song>)) .GetValue(sut); Assert.AreSame(songRepositoryStub.Object, actualSongRepository); }