public void ResourceModel_ToServiceDefinition_GivenXamlPresent_ExpectExistingXamlUsed()
{
const string TestCategory = "Test2";
const string TestXaml = "current xaml";
// ReSharper disable ImplicitlyCapturedClosure
Verify_ToServiceDefinition_GivenXamlPresent(ResourceType.WorkflowService, TestCategory, TestXaml, true, serviceElement =>
// ReSharper restore ImplicitlyCapturedClosure
{
var actionElement = serviceElement.Element("Action");
Assert.IsNotNull(actionElement, "actionElement = null");
var xamlDefinition = actionElement.Element("XamlDefinition");
Assert.IsNotNull(xamlDefinition, "xamlDefinition == null");
Assert.AreEqual(TestXaml, xamlDefinition.Value);
});
Verify_ToServiceDefinition_GivenXamlPresent(ResourceType.Source, TestCategory, "<Root><Category>Test</Category><Source>" + TestXaml + "</Source></Root>", true, serviceElement =>
{
var category = serviceElement.ElementSafe("Category");
var source = serviceElement.ElementSafe("Source");
Assert.AreEqual(TestCategory, category);
Assert.AreEqual(TestXaml, source);
});
// ReSharper disable ImplicitlyCapturedClosure
Verify_ToServiceDefinition_GivenXamlPresent(ResourceType.Service, TestCategory, "<Root><Category>Test</Category><Source>" + TestXaml + "</Source></Root>", true, serviceElement =>
// ReSharper restore ImplicitlyCapturedClosure
{
var category = serviceElement.ElementSafe("Category");
Assert.AreEqual(TestCategory, category);
});
}