public void ActionPropertyMustPass() { var testStep = new Mock <ITestStep>(); testStep.Setup(x => x.Element).Returns("ElementName"); testStep.Setup(x => x.ElementLocator).Returns(ElementLocatorMethods.ID); var activity = new ClickActivity(testStep.Object, _reporter.Object, _driver.Object); Assert.Equal(ActivityTypes.Click.Name, activity.Action.Name); }
private void processElement(String elementType, String xml) { XmlSerializer serializer; switch (elementType) { case CLICK_ACTIVITY_ELEMENT: serializer = new XmlSerializer(typeof(ClickActivity)); ClickActivity clickActivity = null; using (XmlTextReader sr = new XmlTextReader(new StringReader(xml))) { clickActivity = (ClickActivity)serializer.Deserialize(sr); log.Debug("A click event was found for job: " + clickActivity.RequestId); } listener.OnClick(clickActivity); clickCount++; break; case OPEN_ACTIVITY_ELEMENT: serializer = new XmlSerializer(typeof(OpenActivity)); OpenActivity openActivity = null; using (XmlTextReader sr = new XmlTextReader(new StringReader(xml))) { openActivity = (OpenActivity)serializer.Deserialize(sr); log.Debug("An open event was found for job: " + openActivity.RequestId); } listener.OnOpen(openActivity); openCount++; break; case BOUNCE_ACTIVITY_ELEMENT: serializer = new XmlSerializer(typeof(BouncedMessageActivity)); BouncedMessageActivity bouncedMessageActivity = null; using (XmlTextReader sr = new XmlTextReader(new StringReader(xml))) { bouncedMessageActivity = (BouncedMessageActivity)serializer.Deserialize(sr); log.Debug("A bounce event was found for job: " + bouncedMessageActivity.RequestId); } listener.OnBounce(bouncedMessageActivity); bounceCount++; break; case DELIVERED_ACTIVITY_ELEMENT: serializer = new XmlSerializer(typeof(DeliveredMessageActivity)); DeliveredMessageActivity deliveredMessageActivity = null; using (XmlTextReader sr = new XmlTextReader(new StringReader(xml))) { deliveredMessageActivity = (DeliveredMessageActivity)serializer.Deserialize(sr); log.Debug("A delivery event was found for job: " + deliveredMessageActivity.RequestId); } listener.OnDelivery(deliveredMessageActivity); deliveryCount++; break; case SPAM_ACTIVITY_ELEMENT: serializer = new XmlSerializer(typeof(SpamComplaintActivity)); SpamComplaintActivity spamComplaintActivity = null; using (XmlTextReader sr = new XmlTextReader(new StringReader(xml))) { spamComplaintActivity = (SpamComplaintActivity)serializer.Deserialize(sr); log.Debug("A spam complaint event was found for job: " + spamComplaintActivity.RequestId); } listener.OnSpamComplaint(spamComplaintActivity); break; case JOB_ERROR_ACTIVITY_ELEMENT: serializer = new XmlSerializer(typeof(JobErrorActivity)); JobErrorActivity jobErrorActivity = null; using (XmlTextReader sr = new XmlTextReader(new StringReader(xml))) { jobErrorActivity = (JobErrorActivity)serializer.Deserialize(sr); log.Debug("A job error event was found for job: " + jobErrorActivity.RequestId); } listener.OnJobError(jobErrorActivity); jobErrorCount++; break; case RENDER_ERROR_ACTIVITY_ELEMENT: serializer = new XmlSerializer(typeof(RenderErrorActivity)); RenderErrorActivity renderErrorActivity = null; using (XmlTextReader sr = new XmlTextReader(new StringReader(xml))) { renderErrorActivity = (RenderErrorActivity)serializer.Deserialize(sr); log.Debug("A render error event was found for job: " + renderErrorActivity.RequestId); } listener.OnRenderError(renderErrorActivity); renderErrorCount++; break; case UNSUB_ACTIVITY_ELEMENT: serializer = new XmlSerializer(typeof(UnsubActivity)); UnsubActivity unsubActivity = null; using (XmlTextReader sr = new XmlTextReader(new StringReader(xml))) { unsubActivity = (UnsubActivity)serializer.Deserialize(sr); log.Debug("An unsubscribe event was found for job: " + unsubActivity.RequestId); } listener.OnUnsub(unsubActivity); unsubCount++; break; default: // This should never occur as the case statement here should match the one above. log.Error("An unknown event was found: " + xml); break; } }