コード例 #1
0
        public void SendEmailToGateway_AutoMoq2(
            EmailMessage message,
            [Frozen] Mock <IEmailGateway> mockGateway,
            EmailMessageBuffer2 sut)
        {
            //arrange
            sut.Add(message);

            //act
            sut.SendAll();

            //assert
            mockGateway.Verify(x => x.Send(It.IsAny <EmailMessage>()), Times.Once());
        }
コード例 #2
0
        public void SendEmailToGateway_Manual_Moq()
        {
            //arrange
            var fixture = new Fixture();

            var mockGateway = new Mock <IEmailGateway>();

            var sut = new EmailMessageBuffer2(mockGateway.Object);

            sut.Add(fixture.Create <EmailMessage>());

            //act
            sut.SendAll();

            //assert
            mockGateway.Verify(x => x.Send(It.IsAny <EmailMessage>()), Times.Once());
        }