public void PFS_GetVariable_FileInfo_Exception_Error() { using (PFS pfs = new PFS(fi)) { Assert.IsNotNull(fi); Assert.IsTrue(fi.Exists); Assert.AreEqual(fileName, fi.FullName); FileInfo fileInfoRet = pfs.GetVariableFileInfo("FemEngineHD/DOMAIN", "file_name", 1); Assert.IsNotNull(fileInfoRet); Assert.AreEqual(fi.FullName.Replace("Gaspe.m21fm", "Gaspe.mesh"), fileInfoRet.FullName); Assert.AreEqual("", pfs.ErrorMessage); int?intRet = pfs.SetVariable <int>("FemEngineHD/DOMAIN", "file_name", 1, 1); Assert.IsNotNull(intRet); Assert.AreEqual(1, intRet); Assert.AreEqual("", pfs.ErrorMessage); FileInfo fileInfoRet2 = pfs.GetVariableFileInfo("FemEngineHD/DOMAIN", "file_name", 1); Assert.IsNull(fileInfoRet2); Assert.IsFalse(string.IsNullOrWhiteSpace(pfs.ErrorMessage)); pfs.ErrorMessage = ""; fileInfoRet2 = pfs.SetVariableFileInfo("FemEngineHD/DOMAIN", "file_name", 1, fileInfoRet); Assert.IsNotNull(fileInfoRet); Assert.AreEqual(fi.FullName.Replace("Gaspe.m21fm", "Gaspe.mesh"), fileInfoRet.FullName); Assert.AreEqual("", pfs.ErrorMessage); fileInfoRet = pfs.GetVariableFileInfo("FemEngineHD/DOMAIN", "file_name", 1); Assert.IsNotNull(fileInfoRet); Assert.AreEqual(fi.FullName.Replace("Gaspe.m21fm", "Gaspe.mesh"), fileInfoRet.FullName); Assert.AreEqual("", pfs.ErrorMessage); } }
public void PFS_SetVariable_double_OK() { using (PFS pfs = new PFS(fi)) { Assert.IsNotNull(fi); Assert.IsTrue(fi.Exists); Assert.AreEqual(fileName, fi.FullName); double?doubleRet = pfs.GetVariable <double>("FemEngineHD/DOMAIN", "minimum_depth", 1); Assert.IsNotNull(doubleRet); Assert.IsTrue(doubleRet.ToString().StartsWith("-0.4999")); Assert.AreEqual("", pfs.ErrorMessage); doubleRet = pfs.SetVariable <double>("FemEngineHD/DOMAIN", "minimum_depth", 1, 0.777D); Assert.IsNotNull(doubleRet); Assert.IsTrue(doubleRet.ToString().StartsWith("0.777")); Assert.AreEqual("", pfs.ErrorMessage); doubleRet = pfs.GetVariable <double>("FemEngineHD/DOMAIN", "minimum_depth", 1); Assert.IsNotNull(doubleRet); Assert.AreEqual(0.777D, doubleRet); Assert.AreEqual("", pfs.ErrorMessage); doubleRet = pfs.SetVariable <double>("FemEngineHD/DOMAIN", "minimum_depth", 1, -0.4999854D); Assert.IsNotNull(doubleRet); Assert.AreEqual(-0.4999854D, doubleRet); Assert.AreEqual("", pfs.ErrorMessage); doubleRet = pfs.GetVariable <double>("FemEngineHD/DOMAIN", "minimum_depth", 1); Assert.IsNotNull(doubleRet); Assert.AreEqual(-0.4999854D, doubleRet); Assert.AreEqual("", pfs.ErrorMessage); } }
public void PFS_GetVariable_DateTime_Exception_Error() { using (PFS pfs = new PFS(fi)) { Assert.IsNotNull(fi); Assert.IsTrue(fi.Exists); Assert.AreEqual(fileName, fi.FullName); DateTime?dateTimeRet = pfs.GetVariableDateTime("FemEngineHD/TIME", "start_time"); Assert.IsNotNull(dateTimeRet); Assert.AreEqual(new DateTime(2011, 1, 1, 0, 0, 0), dateTimeRet); Assert.AreEqual("", pfs.ErrorMessage); int value = 300; int ParameterIndex = 6; // seconds int?intRet = pfs.SetVariable <int>("FemEngineHD/TIME", "start_time", ParameterIndex, value); Assert.IsNotNull(intRet); dateTimeRet = pfs.GetVariableDateTime("FemEngineHD/TIME", "start_time"); Assert.IsNull(dateTimeRet); Assert.IsFalse(string.IsNullOrWhiteSpace(pfs.ErrorMessage)); pfs.ErrorMessage = ""; value = 0; ParameterIndex = 6; // seconds intRet = pfs.SetVariable <int>("FemEngineHD/TIME", "start_time", ParameterIndex, value); Assert.IsNotNull(intRet); dateTimeRet = pfs.GetVariableDateTime("FemEngineHD/TIME", "start_time"); Assert.IsNotNull(dateTimeRet); Assert.AreEqual(new DateTime(2011, 1, 1, 0, 0, 0), dateTimeRet); Assert.AreEqual("", pfs.ErrorMessage); } }
public void PFS_SetVariable_float_OK() { using (PFS pfs = new PFS(fi)) { Assert.IsNotNull(fi); Assert.IsTrue(fi.Exists); Assert.AreEqual(fileName, fi.FullName); float?floatRet = pfs.GetVariable <float>("FemEngineHD/DOMAIN", "minimum_depth", 1); Assert.IsNotNull(floatRet); Assert.IsTrue(floatRet.ToString().StartsWith("-0.4999")); Assert.AreEqual("", pfs.ErrorMessage); floatRet = pfs.SetVariable <float>("FemEngineHD/DOMAIN", "minimum_depth", 1, 0.777f); Assert.IsNotNull(floatRet); Assert.AreEqual(0.777f, floatRet); Assert.AreEqual("", pfs.ErrorMessage); floatRet = pfs.GetVariable <float>("FemEngineHD/DOMAIN", "minimum_depth", 1); Assert.IsNotNull(floatRet); Assert.AreEqual(0.777f, floatRet); Assert.AreEqual("", pfs.ErrorMessage); floatRet = pfs.SetVariable <float>("FemEngineHD/DOMAIN", "minimum_depth", 1, -0.4999854f); Assert.IsNotNull(floatRet); Assert.AreEqual(-0.4999854f, floatRet); Assert.AreEqual("", pfs.ErrorMessage); floatRet = pfs.GetVariable <float>("FemEngineHD/DOMAIN", "minimum_depth", 1); Assert.IsNotNull(floatRet); Assert.AreEqual(-0.4999854f, floatRet); Assert.AreEqual("", pfs.ErrorMessage); } }
public void PFS_SetVariable_int_OK() { using (PFS pfs = new PFS(fi)) { Assert.IsNotNull(fi); Assert.IsTrue(fi.Exists); Assert.AreEqual(fileName, fi.FullName); int?doubleRet = pfs.GetVariable <int>("FemEngineHD/DOMAIN", "discretization", 1); Assert.IsNotNull(doubleRet); Assert.AreEqual(2, doubleRet); Assert.AreEqual("", pfs.ErrorMessage); doubleRet = pfs.SetVariable <int>("FemEngineHD/DOMAIN", "discretization", 1, 3); Assert.IsNotNull(doubleRet); Assert.AreEqual(3, doubleRet); Assert.AreEqual("", pfs.ErrorMessage); doubleRet = pfs.GetVariable <int>("FemEngineHD/DOMAIN", "discretization", 1); Assert.IsNotNull(doubleRet); Assert.AreEqual(3, doubleRet); Assert.AreEqual("", pfs.ErrorMessage); doubleRet = pfs.SetVariable <int>("FemEngineHD/DOMAIN", "discretization", 1, 2); Assert.IsNotNull(doubleRet); Assert.AreEqual(2, doubleRet); Assert.AreEqual("", pfs.ErrorMessage); doubleRet = pfs.GetVariable <int>("FemEngineHD/DOMAIN", "discretization", 1); Assert.IsNotNull(doubleRet); Assert.AreEqual(2, doubleRet); Assert.AreEqual("", pfs.ErrorMessage); } }
public JsonResult GetFruitTotals(List <Models.FruitStandStuff> fruitlist, string toDate, string fromDate) { pfs = new PFS(); var result = pfs.TotalsByDateRange(fruitlist, toDate, fromDate); return(Json(result, JsonRequestBehavior.AllowGet)); }
protected void Page_Load(object sender, EventArgs e) { _4screen.CSB.Extensions.Business.TrackingManager.TrackEventPage(null, null, IsPostBack, LogSitePageType.Friends); try { Guid userID = new Guid(Request.QueryString["UID"]); Guid friendID = new Guid(Request.QueryString["FID"]); if (FriendHandler.IsFriend(userID, friendID)) { PFS.UserID = userID; PFS.FriendID = friendID; if (!IsPostBack) { PFS.LoadSetting(); } } else { Response.Redirect("/pages/static/AccessDenied.aspx", true); } } catch { Response.Redirect("/pages/static/AccessDenied.aspx", true); } }
public void PFS_SetVariable_bool_OK() { using (PFS pfs = new PFS(fi)) { Assert.IsNotNull(fi); Assert.IsTrue(fi.Exists); Assert.AreEqual(fileName, fi.FullName); bool?boolRet = pfs.GetVariable <bool>("FemEngineHD/MUD_TRANSPORT_MODULE/WATER_COLUMN/SAND_FRACTIONS/FRACTION_1", "include_sand", 1); Assert.IsNotNull(boolRet); Assert.AreEqual(true, boolRet); Assert.AreEqual("", pfs.ErrorMessage); boolRet = pfs.SetVariable <bool>("FemEngineHD/MUD_TRANSPORT_MODULE/WATER_COLUMN/SAND_FRACTIONS/FRACTION_1", "include_sand", 1, false); Assert.IsNotNull(boolRet); Assert.AreEqual(false, boolRet); Assert.AreEqual("", pfs.ErrorMessage); boolRet = pfs.GetVariable <bool>("FemEngineHD/MUD_TRANSPORT_MODULE/WATER_COLUMN/SAND_FRACTIONS/FRACTION_1", "include_sand", 1); Assert.IsNotNull(boolRet); Assert.AreEqual(false, boolRet); Assert.AreEqual("", pfs.ErrorMessage); boolRet = pfs.SetVariable <bool>("FemEngineHD/MUD_TRANSPORT_MODULE/WATER_COLUMN/SAND_FRACTIONS/FRACTION_1", "include_sand", 1, true); Assert.IsNotNull(boolRet); Assert.AreEqual(true, boolRet); Assert.AreEqual("", pfs.ErrorMessage); boolRet = pfs.GetVariable <bool>("FemEngineHD/MUD_TRANSPORT_MODULE/WATER_COLUMN/SAND_FRACTIONS/FRACTION_1", "include_sand", 1); Assert.IsNotNull(boolRet); Assert.AreEqual(true, boolRet); Assert.AreEqual("", pfs.ErrorMessage); } }
public void Test() { for (int i = 0; i < testfiles.Length; i++) { string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "pfs3", testfiles[i]); IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); Assert.AreEqual(true, image.Open(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]); List <Partition> partitions = Core.Partitions.GetAll(image); IFilesystem fs = new PFS(); int part = -1; for (int j = 0; j < partitions.Count; j++) { if (partitions[j].Type == "\"PFS\\1\"") { part = j; break; } } Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out _, null); Assert.AreEqual(clusters[i], fs.XmlFsType.Clusters, testfiles[i]); Assert.AreEqual(clustersize[i], fs.XmlFsType.ClusterSize, testfiles[i]); Assert.AreEqual("PFS v3", fs.XmlFsType.Type, testfiles[i]); Assert.AreEqual(volumename[i], fs.XmlFsType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFsType.VolumeSerial, testfiles[i]); Assert.AreEqual(oemid[i], fs.XmlFsType.SystemIdentifier, testfiles[i]); } }
public void PFS_Constructor_File_DoesNotExist_From_DHIBase_Error() { FileInfo fiTemp = new FileInfo(fi.FullName + "aa"); using (PFS pfs = new PFS(fiTemp)) { Assert.AreEqual(string.Format(CSSPDHIRes.File_DoesNotExist, fiTemp.FullName), pfs.ErrorMessage); } }
public void PFS_Constructor_OK() { using (PFS pfs = new PFS(fi)) { Assert.IsNotNull(fi); Assert.IsTrue(fi.Exists); Assert.AreEqual(fileName, fi.FullName); } }
public void PFS_GetVariable_bool_File_DoesNotExist_In_GetBool_Error() { using (PFS pfs = new PFS(fi)) { pfs.fi = new FileInfo(fi.FullName + "aa"); bool?boolRet = pfs.GetVariable <bool>("FemEngineHD/MUD_TRANSPORT_MODULE/WATER_COLUMN/SAND_FRACTIONS/FRACTION_1", "include_sand", 1); Assert.IsNull(boolRet); Assert.AreEqual(string.Format(CSSPDHIRes.File_DoesNotExist, pfs.fi.FullName), pfs.ErrorMessage); } }
public void PFS_SetVariable_DateTime_Exception_Error() { using (PFS pfs = new PFS(fi)) { Assert.IsNotNull(fi); Assert.IsTrue(fi.Exists); Assert.AreEqual(fileName, fi.FullName); // ToDo: should try to write test code } }
public void PFS_SetVariable_bit_not_implemented_should_return_null_OK() { using (PFS pfs = new PFS(fi)) { Assert.IsNotNull(fi); Assert.IsTrue(fi.Exists); Assert.AreEqual(fileName, fi.FullName); decimal?decimalRet = pfs.SetVariable <decimal>("FemEngineHD/DOMAIN", "minimum_depth", 1, 123.456m); Assert.IsNull(decimalRet); } }
public void PFS_GetVariable_DateTime_CheckAll_Error() { using (PFS pfs = new PFS(fi)) { Assert.IsNotNull(fi); Assert.IsTrue(fi.Exists); Assert.AreEqual(fileName, fi.FullName); DateTime?dateTimeRet = pfs.GetVariableDateTime("FemEngineHD/TIME", "start_timeNot"); Assert.IsNull(dateTimeRet); } }
public void PFS_SetVariable_bool_Exception_Error() { using (PFS pfs = new PFS(fi)) { Assert.IsNotNull(fi); Assert.IsTrue(fi.Exists); Assert.AreEqual(fileName, fi.FullName); bool?boolRet = pfs.SetVariable <bool>("FemEngineHD/MUD_TRANSPORT_MODULE/WATER_COLUMN/SAND_FRACTIONS/FRACTION_1", "include_sand", 4, false); Assert.IsNull(boolRet); Assert.IsFalse(string.IsNullOrWhiteSpace(pfs.ErrorMessage)); } }
public void PFS_SetVariable_FileInfo_Exception_Error() { using (PFS pfs = new PFS(fi)) { Assert.IsNotNull(fi); Assert.IsTrue(fi.Exists); Assert.AreEqual(fileName, fi.FullName); FileInfo fileInfoRet = pfs.SetVariableFileInfo("FemEngineHD/DOMAIN", "file_name", 4, new FileInfo("allo")); Assert.IsNull(fileInfoRet); Assert.IsFalse(string.IsNullOrWhiteSpace(pfs.ErrorMessage)); } }
public void PFS_GetVariable_string_Exception_Error() { using (PFS pfs = new PFS(fi)) { Assert.IsNotNull(fi); Assert.IsTrue(fi.Exists); Assert.AreEqual(fileName, fi.FullName); string strRet = pfs.GetVariableString("FemEngineHD/DOMAIN", "coordinate_type", 3); Assert.IsTrue(string.IsNullOrWhiteSpace(strRet)); Assert.IsFalse(string.IsNullOrWhiteSpace(pfs.ErrorMessage)); } }
public void PFS_GetVariable_DateTime_OK() { using (PFS pfs = new PFS(fi)) { Assert.IsNotNull(fi); Assert.IsTrue(fi.Exists); Assert.AreEqual(fileName, fi.FullName); DateTime?dateTimeRet = pfs.GetVariableDateTime("FemEngineHD/TIME", "start_time"); Assert.IsNotNull(dateTimeRet); Assert.AreEqual(new DateTime(2011, 1, 1, 0, 0, 0), dateTimeRet); Assert.AreEqual("", pfs.ErrorMessage); } }
public void PFS_GetVariable_bool_WrongFileTypeLookingFor__Error() { FileInfo fi = new FileInfo(@"C:\CSSP Latest Code Old\CSSPDHIFormApp\CSSPDHIFormApp\trans_Mike21.dfsu"); using (PFS pfs = new PFS(fi)) { Assert.IsNotNull(fi); Assert.IsTrue(fi.Exists); bool? boolRet = pfs.GetVariable <bool>("FemEngineHD/MUD_TRANSPORT_MODULE/WATER_COLUMN/SAND_FRACTIONS/FRACTION_1", "include_sand", 1); string ErrorMessage = string.Format(CSSPDHIRes.WrongFileTypeLookingFor_, "[.m21fm or .m3fm]"); Assert.AreEqual(ErrorMessage, pfs.ErrorMessage.Substring(0, ErrorMessage.Length)); } }
public void PFS_GetVariable_bool_CouldNotFindSectionForPath__Error() { using (PFS pfs = new PFS(fi)) { Assert.IsNotNull(fi); Assert.IsTrue(fi.Exists); Assert.AreEqual(fileName, fi.FullName); string path = "FemEngineHD/MUD_TRANSPORT_MODULE/WATER_COLUMN/SAND_FRACTIONS/ThisPathDoesNotExist"; bool? boolRet = pfs.GetVariable <bool>(path, "include_sand", 1); Assert.IsNull(boolRet); Assert.AreEqual(string.Format(CSSPDHIRes.CouldNotFindSectionForPath_, path), pfs.ErrorMessage); } }
public void PFS_SetVariable_string_CheckAll_Error() { using (PFS pfs = new PFS(fi)) { Assert.IsNotNull(fi); Assert.IsTrue(fi.Exists); Assert.AreEqual(fileName, fi.FullName); string strRet = "LONG/LATAAA"; strRet = pfs.SetVariableString("FemEngineHD/DOMAIN", "coordinate_typenot", 1, strRet); Assert.IsTrue(string.IsNullOrWhiteSpace(strRet)); Assert.IsFalse(string.IsNullOrWhiteSpace(pfs.ErrorMessage)); } }
public void PFS_GetVariable_bool_false_OK() { using (PFS pfs = new PFS(fi)) { Assert.IsNotNull(fi); Assert.IsTrue(fi.Exists); Assert.AreEqual(fileName, fi.FullName); bool?boolRet = pfs.GetVariable <bool>("FemEngineHD/MUD_TRANSPORT_MODULE/WATER_COLUMN/DENSITY_AND_VISCOSITY", "include_density_feedback_on_HD", 1); Assert.IsNotNull(boolRet); Assert.AreEqual(false, boolRet); Assert.AreEqual("", pfs.ErrorMessage); } }
public void PFS_GetVariable_string_OK() { using (PFS pfs = new PFS(fi)) { Assert.IsNotNull(fi); Assert.IsTrue(fi.Exists); Assert.AreEqual(fileName, fi.FullName); string strRet = pfs.GetVariableString("FemEngineHD/DOMAIN", "coordinate_type", 1); Assert.IsNotNull(strRet); Assert.AreEqual("LONG/LAT", strRet); Assert.AreEqual("", pfs.ErrorMessage); } }
public void PFS_GetVariable_FileInfo_OK() { using (PFS pfs = new PFS(fi)) { Assert.IsNotNull(fi); Assert.IsTrue(fi.Exists); Assert.AreEqual(fileName, fi.FullName); FileInfo fileInfoRet = pfs.GetVariableFileInfo("FemEngineHD/DOMAIN", "file_name", 1); Assert.IsNotNull(fileInfoRet); Assert.AreEqual(fi.FullName.Replace("Gaspe.m21fm", "Gaspe.mesh"), fileInfoRet.FullName); Assert.AreEqual("", pfs.ErrorMessage); } }
public void PFS_GetVariable_float_OK() { using (PFS pfs = new PFS(fi)) { Assert.IsNotNull(fi); Assert.IsTrue(fi.Exists); Assert.AreEqual(fileName, fi.FullName); double?doubleRet = pfs.GetVariable <float>("FemEngineHD/DOMAIN", "minimum_depth", 1); Assert.IsNotNull(doubleRet); Assert.AreEqual(-0.4999854f, doubleRet); Assert.AreEqual("", pfs.ErrorMessage); } }
public void PFS_SetVariable_DateTime_CheckAll_Error() { using (PFS pfs = new PFS(fi)) { Assert.IsNotNull(fi); Assert.IsTrue(fi.Exists); Assert.AreEqual(fileName, fi.FullName); DateTime?dateTimeRet = new DateTime(2011, 1, 1, 0, 0, 5); dateTimeRet = pfs.SetVariableDateTime("FemEngineHD/TIME", "start_timeNot", (DateTime)dateTimeRet); Assert.IsNull(dateTimeRet); Assert.IsFalse(string.IsNullOrWhiteSpace(pfs.ErrorMessage)); } }
public void PFS_GetVariable_bool_Keyword_DoesNotExistForSectionPath_Error__Error() { using (PFS pfs = new PFS(fi)) { Assert.IsNotNull(fi); Assert.IsTrue(fi.Exists); Assert.AreEqual(fileName, fi.FullName); string keyword = "NotAnExistingKeyword"; string path = "FemEngineHD/MUD_TRANSPORT_MODULE/WATER_COLUMN/SAND_FRACTIONS/FRACTION_1"; bool? boolRet = pfs.GetVariable <bool>(path, keyword, 1); Assert.IsNull(boolRet); string ErrorMessage = string.Format(CSSPDHIRes.Keyword_DoesNotExistForSectionPath_Error_, keyword, path, ""); Assert.AreEqual(ErrorMessage, pfs.ErrorMessage.Substring(0, ErrorMessage.Length - 1) + "]"); } }
public void Test() { for (int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Professional File System 3", _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); Assert.AreEqual(true, image.Open(filter), _testFiles[i]); Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List <Partition> partitions = Core.Partitions.GetAll(image); IFilesystem fs = new PFS(); int part = -1; for (int j = 0; j < partitions.Count; j++) { if (partitions[j].Type == "\"PFS\\1\"") { part = j; break; } } Assert.AreNotEqual(-1, part, $"Partition not found on {_testFiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), _testFiles[i]); fs.GetInformation(image, partitions[part], out _, null); Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); Assert.AreEqual("PFS v3", fs.XmlFsType.Type, _testFiles[i]); Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); } }