public void ShouldChangeCompanyName() { // Arrange this.shareTableRepository = Substitute.For <IShareTableRepository>(); int testId = 55; this.shareTableRepository.ContainsById(Arg.Is(testId)).Returns(true); SharesService sharesService = new SharesService(this.shareTableRepository); string newCompanyName = "Seas and oceans"; // Act sharesService.ChangeCompanyName(testId, newCompanyName); // Assert this.shareTableRepository.Received(1).SetCompanyName(testId, newCompanyName); this.shareTableRepository.Received(1).SaveChanges(); }