コード例 #1
0
        public void ShouldCallXyzServiceToSendNotification()
        {
            // given
            var             xyzServiceMock = new Mock <IXYZService>();
            ABCNotification notification   = new Filler <ABCNotification>().Create();

            ABCNotificationResponse notificationResponse =
                new Filler <ABCNotificationResponse>().Create();

            xyzServiceMock.Setup(broker => broker.SendNotification(notification))
            .Returns(notificationResponse);

            // when
            var aService = new AService(xyzServiceMock.Object);

            aService.DoStuffA(notification);

            // then
            xyzServiceMock.Verify(
                broker => broker.SendNotification(notification),
                Times.Once);
        }