示例#1
0
        private void Approve(Mock <IStory> story)
        {
            var postedBy = new Mock <IUser>();

            story.ExpectGet(s => s.PostedBy).Returns(postedBy.Object);

            story.Expect(s => s.Approve(It.IsAny <DateTime>())).Verifiable();
            _emailSender.Expect(es => es.NotifyStoryApprove(It.IsAny <string>(), It.IsAny <IStory>(), It.IsAny <IUser>())).Verifiable();

            var byUser = new Mock <IUser>();

            _storyService.Approve(story.Object, "http://dotnetshoutout.com/Dummy-Story", byUser.Object);
        }
示例#2
0
        private void Approve(Mock <IStory> story)
        {
            var postedBy = new Mock <IUser>();

            story.SetupGet(s => s.PostedBy).Returns(postedBy.Object);

            story.Setup(s => s.Approve(It.IsAny <DateTime>())).Verifiable();

            _storyApproveEvent = new Mock <StoryApproveEvent>();
            _eventAggregator.Setup(ea => ea.GetEvent <StoryApproveEvent>()).Returns(_storyApproveEvent.Object).Verifiable();
            _storyApproveEvent.Setup(e => e.Publish(It.IsAny <StoryApproveEventArgs>())).Verifiable();

            var byUser = new Mock <IUser>();

            _storyService.Approve(story.Object, "http://dotnetshoutout.com/Dummy-Story", byUser.Object);
        }