Beispiel #1
0
        public void ShouldRequireValidSourceId()
        {
            var command = new DeleteSource {
                PathId = 1, ModuleId = 1, ThemeId = 1, Id = 999999
            };

            FluentActions.Invoking(() =>
                                   SendAsync(command)).Should().ThrowAsync <NotFoundException>();
        }
Beispiel #2
0
        public XmlNode AsXml(XmlDocument doc)
        {
            XmlNode opNode = doc.CreateNode(XmlNodeType.Element, "CopyOperation", "");

            XmlAttribute opName = doc.CreateAttribute("name");

            opName.InnerText = Name;
            XmlAttribute opDeleteSource = doc.CreateAttribute("deleteSource");

            opDeleteSource.InnerText = DeleteSource.ToString().ToLower();
            XmlAttribute opCalledExternal = doc.CreateAttribute("calledFromExternal");

            opCalledExternal.InnerText = CalledFromExternal.ToString().ToLower();
            XmlAttribute opEnabled = doc.CreateAttribute("enabled");

            opEnabled.InnerText = Enabled ? "true" : "false";

            opNode.Attributes.Append(opName);
            opNode.Attributes.Append(opDeleteSource);
            opNode.Attributes.Append(opCalledExternal);
            opNode.Attributes.Append(opEnabled);

            // source
            XmlAttribute sourceName = doc.CreateAttribute("name");
            XmlNode      sourceNode = doc.CreateNode(XmlNodeType.Element, "source", "");
            XmlAttribute sourceUrl  = doc.CreateAttribute("url");

            sourceUrl.InnerText = Helper.FormatUrl(SourceUrl);
            sourceNode.Attributes.Append(sourceUrl);
            sourceName.InnerText = "source...";
            sourceNode.Attributes.Append(sourceName);


            if (SourceUname != string.Empty && SourceUname != null &
                SourcePwd != string.Empty && SourcePwd != null)
            {
                XmlNode sourceCredNode = doc.CreateNode(XmlNodeType.Element, "credentials", "");

                XmlAttribute srcUName = doc.CreateAttribute("username");
                srcUName.InnerText = SourceUname;
                sourceCredNode.Attributes.Append(srcUName);

                XmlAttribute srcPwd = doc.CreateAttribute("password");
                srcPwd.InnerText = SourcePwd;
                sourceCredNode.Attributes.Append(srcPwd);

                sourceNode.AppendChild(sourceCredNode);
            }

            opNode.AppendChild(sourceNode);

            // targets
            XmlNode targetsNode = doc.CreateNode(XmlNodeType.Element, "targets", "");

            foreach (FileMateTargetDTO targetDto in Targets)
            {
                targetsNode.AppendChild(targetDto.AsXml(doc));
            }

            opNode.AppendChild(targetsNode);

            // schedule
            XmlNode scheduleNode = doc.CreateNode(XmlNodeType.Element, "schedule", "");

            scheduleNode.InnerText = Schedule;
            opNode.AppendChild(scheduleNode);

            // pattern
            XmlNode patternNode = doc.CreateNode(XmlNodeType.Element, "pattern", "");

            patternNode.InnerText = Pattern;
            opNode.AppendChild(patternNode);

            return(opNode);
        }