Example #1
0
        public void TestServiceShouldCallRepoMethodOnce()
        {
            //Given
            var mockRepo = new Mock <IWatchRepository>();
            var service  = new WatchService(mockRepo.Object);

            //When
            mockRepo.Setup(mr => mr.RemoveMachineSubscriptionFromWatch(It.IsAny <MachineWatch>()));

            service.DeleteMachineSubscriptionFromWatch(new MachineWatch());

            //Then
            mockRepo.Verify(mr => mr.RemoveMachineSubscriptionFromWatch(It.IsAny <MachineWatch>()), Times.Once);
        }