public void CreateXmlTest() { string xmlName = "Opp"; string xmlName1 = "AddOpp"; var mock = new Mock <IOoportunityService>(); mock.Setup(m => m.GetOpportunities()).Returns(new List <OpportunityDTO> { new OpportunityDTO { OpportunityId = "1" } }); SerializerService service = new SerializerService(mock.Object); Assert.IsTrue(service.CreateXml(xmlName)); Assert.IsTrue(service.CreateXml(xmlName1)); }
public void GetXmlNameTest() { string xmlName = "Opp"; string xmlName1 = "AddOpp"; var mock = new Mock <IOoportunityService>(); mock.Setup(m => m.GetOpportunities()).Returns(new List <OpportunityDTO> { new OpportunityDTO { OpportunityId = "1" } }); SerializerService service = new SerializerService(mock.Object); service.CreateXml(xmlName); service.CreateXml(xmlName1); Assert.AreEqual("AddOpp.xml", service.GetXmlName()[0]); Assert.AreEqual("Opp.xml", service.GetXmlName()[1]); }
public void GetXmlInfoTest() { string localPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase + @"\Xml\"; string xmlName = "Opp"; string xmlName1 = "AddOpp"; var mock = new Mock <IOoportunityService>(); mock.Setup(m => m.GetOpportunities()).Returns(new List <OpportunityDTO> { new OpportunityDTO { OpportunityId = "1" } }); SerializerService service = new SerializerService(mock.Object); service.CreateXml(xmlName); service.CreateXml(xmlName1); Assert.AreEqual(localPath + xmlName1 + ".xml", service.GetXmlInfo()[0]); Assert.AreEqual(localPath + xmlName + ".xml", service.GetXmlInfo()[1]); }
public bool CreateOppXml([FromUri] string xmlName) { return(_serializerService.CreateXml(xmlName)); }