public void SubjectDispatchTemplate_ProvideXSLTContentTest() { //параметры var builder = new SubjectDispatchTemplate<Guid>() { BodyProvider = new FileTemplate("Content/ProductsOrder.xslt"), BodyTransformer = new XslTransformer() }; object objectModel = CreateObjectModel(); Subscriber<Guid> subscriber = new Subscriber<Guid>() { UserID = Guid.NewGuid() }; TemplateData bodyData = new TemplateData(objectModel); //проверка Stopwatch timer = Stopwatch.StartNew(); SubjectDispatch<Guid> item = (SubjectDispatch<Guid>)builder.Build(subscriber, bodyData); TimeSpan total = timer.Elapsed; Assert.IsNotNull(item.MessageBody); }
public void SubjectDispatchTemplate_ProvideContentTest() { //параметры var builder = new SubjectDispatchTemplate<Guid>() { BodyProvider = new ResourceTemplate(typeof(ContentRes), "ContentKey"), BodyTransformer = new ReplaceTransformer() }; var replaceModel = new Dictionary<string, string>() { { "key", "value" } }; var subscriber = new Subscriber<Guid>(){ UserID = Guid.NewGuid() }; TemplateData bodyData = new TemplateData(replaceModel); //проверка SubjectDispatch<Guid> item = (SubjectDispatch<Guid>)builder.Build(subscriber, bodyData); Assert.AreEqual(ContentRes.ContentKey, item.MessageBody); }