Ejemplo n.º 1
0
        public void Can_read_who_changed_the_workitem_from_alert_xml_block()
        {
            // Arrange
            var alertMessage = TestData.DummyWorkItemChangedAlertXml();

            // act
            var actual = EventXmlHelper.GetChangedBy(alertMessage);

            // assert
            Assert.AreEqual("Administrator", actual);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Sends an email based on a template
        /// </summary>
        /// <param name="workItemId">The work item ID</param>
        /// <param name="templatePath">Path to the email template</param>
        /// <param name="dumpAllWorkItemFields">If true appends all work item fields to the email</param>
        /// <param name="dumpAllAlertFields">If true appends all alert fields to the email</param>
        /// <param name="showMissingFieldNames">If true adds error messages for incorrect field names</param>
        public void SendEmail(int workItemId, string templatePath, bool dumpAllWorkItemFields, bool dumpAllAlertFields, bool showMissingFieldNames)
        {
            // Get this list of changes
            var alertItems = EventXmlHelper.GetWorkItemChangedAlertFields(this.eventXml);
            var changedBy  = EventXmlHelper.GetChangedBy(this.eventXml);

            // Create a new Tfs helper
            var fieldLookupProvider = new TfsFieldLookupProvider(
                this.iTfsProvider.GetWorkItem(workItemId),
                alertItems,
                changedBy,
                showMissingFieldNames);

            // Process the email using a template
            this.iEmailProvider.SendEmailAlert(
                fieldLookupProvider,
                templatePath,
                dumpAllWorkItemFields,
                dumpAllAlertFields);
        }