public void TestRepoShouldBeCalledOnceIfAlarmWatchIsNotEmptyOrNull() { //Given var mockRepo = new Mock <IWatchRepository>(); var service = new WatchService(mockRepo.Object); AlarmWatch aw = new AlarmWatch { Alarm = new Core.Entity.DB.Alarm { AlarmId = 1, Code = 205, Description = "TestDescription" }, WatchId = "1" }; //When mockRepo.Setup(mr => mr.SubscribeToAlarm(It.IsAny <AlarmWatch>())); service.SubscribeToAlarm(aw); //Then mockRepo.Verify(mr => mr.SubscribeToAlarm(It.IsAny <AlarmWatch>()), Times.Once); }