public void SetUp() { _pathProvider = MockRepository.GenerateMock <IPathProvider>(); _xmlPath = FakeXmlPath.CrateXmlPaths(); _xlnConfigCommon = FakePublicWebsiteXml.CreateCommonSection(); _xlnConfiguration = FakeConfigurationXml.CreateXlnConfiguration(); }
public void SetUp() { _configReader = MockRepository.GenerateStub <IXmlConfigReader>(); _configWriter = MockRepository.GenerateStub <IXmlConfigWriter>(); _xlnConfigCommon = FakePublicWebsiteXml.CreateCommonSection(); _xlnConfigTelecom = FakePublicWebsiteXml.CreateTelecomSection(); _xlnMainSection = FakePublicWebsiteXml.CreateXlnMainSection(); _xDoc = GetFakeXmlFile(); }
public void Should_Load_Config_File_And_Set_Propeties_For_Common(Type configType, string section) { // Arrange _xDoc = GetFakeXmlFile(); _xlnConfigCommon = MockRepository.GenerateMock <XlnConfigCommon>(); _pathProvider.Stub(m => m.MapPath(Arg <string> .Is.Anything)).Return(_xmlPath.PublicWebSiteConfig); _xmlReader = MockRepository.GenerateMock <XmlConfigEngine>(_pathProvider); _xmlReader.Stub(m => m.GetXmlFile(Arg <string> .Is.Anything)).Return(_xDoc); // Act _xmlReader.LoadConfigs <XlnConfigCommon>(configType, _xmlPath.PublicWebSiteConfig, section, _xlnConfigCommon); // Assert Assert.AreEqual(_xlnConfigCommon.ProductionMode, false); Assert.AreEqual(_xlnConfigCommon.WcfUrl, "localhost"); Assert.AreEqual(_xlnConfigCommon.WcfUserName, "thanh"); Assert.AreEqual(_xlnConfigCommon.CompanyName, "XLN Telecom Ltd."); Assert.AreEqual(_xlnConfigCommon.BuildingName, "1st floor"); Assert.AreEqual(_xlnConfigCommon.StreetName, "Millbank"); Assert.AreEqual(_xlnConfigCommon.City, "London"); Assert.AreEqual(_xlnConfigCommon.PostalCode, "SW1P 4QP"); }
private static void CreateCommonSection(XlnConfigCommon commonSection, XElement commonElement) { var productionMode = new XElement("ProductionMode", commonSection.ProductionMode); commonElement.Add(productionMode); var wcfUrl = new XElement("WcfUrl", commonSection.WcfUrl); commonElement.Add(wcfUrl); var wcfUrerName = new XElement("WcfUserName", commonSection.WcfUserName); commonElement.Add(wcfUrerName); var wcfPassword = new XElement("WcfPassword", commonSection.WcfPassword); commonElement.Add(wcfPassword); var companyName = new XElement("CompanyName", commonSection.CompanyName); commonElement.Add(companyName); var buildingName = new XElement("BuildingName", commonSection.BuildingName); commonElement.Add(buildingName); var streetName = new XElement("StreetName", commonSection.StreetName); commonElement.Add(streetName); var city = new XElement("City", commonSection.City); commonElement.Add(city); var postalCode = new XElement("PostalCode", commonSection.PostalCode); commonElement.Add(postalCode); }
public JsonResult UpdateCommon(XlnConfigCommon xlnConfigCommon) { ConfigWriter.UpdateXmlElement(xlnConfigCommon, XmlPaths.PublicWebSiteConfig, "configs", "common", xlnConfigCommon); ConfigWriter.SaveXmlFile(XmlPaths.PublicWebSiteConfig); return(Json(xlnConfigCommon, JsonRequestBehavior.AllowGet)); }