Summary

Class:FakeXrmEasy.FakeMessageExecutors.SendEmailRequestExecutor
Assembly:FakeXrmEasy
File(s):F:\Git\fake-xrm-easy\FakeXrmEasy.Shared\FakeMessageExecutors\SendEmailRequestExecutor.cs
Covered lines:16
Uncovered lines:0
Coverable lines:16
Total lines:34
Line coverage:100%

Metrics

MethodCyclomatic ComplexitySequence CoverageBranch Coverage
CanExecute(...)1100100
Execute(...)1100100
GetResponsibleRequestType()1100100

File(s)

F:\Git\fake-xrm-easy\FakeXrmEasy.Shared\FakeMessageExecutors\SendEmailRequestExecutor.cs

#LineLine coverage
 1using System;
 2using Microsoft.Crm.Sdk.Messages;
 3using Microsoft.Xrm.Sdk;
 4
 5namespace FakeXrmEasy.FakeMessageExecutors
 6{
 7    public class SendEmailRequestExecutor : IFakeMessageExecutor
 8    {
 9        public bool CanExecute(OrganizationRequest request)
 610        {
 611            return request is SendEmailRequest;
 612        }
 13
 14        public OrganizationResponse Execute(OrganizationRequest request, XrmFakedContext ctx)
 615        {
 616            var req = request as SendEmailRequest;
 17#if FAKE_XRM_EASY || FAKE_XRM_EASY_2013
 218            var entity = new Entity("email");
 219            entity.Id = req.EmailId;
 20#else
 421            var entity = new Entity("email", req.EmailId);
 22#endif
 623            entity["statecode"] = new OptionSetValue(1); //Completed
 624            entity["statuscode"] = new OptionSetValue(3); //Sent
 625            ctx.GetOrganizationService().Update(entity);
 626            return new SendEmailResponse();
 627        }
 28
 29        public Type GetResponsibleRequestType()
 426430        {
 426431            return typeof(SendEmailRequest);
 426432        }
 33    }
 34}