public void Test_TAGFilePreScan_NEEposition() { // Lat/Long refers to the GPS_BASE_Position // therefore SeedLatitude and SeedLongitude not available // NE can be used along with the projects CSIB to resolve to a LL var preScan = new TAGFilePreScan(); Assert.True(preScan.Execute(new FileStream(Path.Combine("TestData", "TAGFiles", "SeedPosition-usingNEE.tag"), FileMode.Open, FileAccess.Read)), "Pre-scan execute returned false"); preScan.ProcessedEpochCount.Should().Be(1); preScan.ReadResult.Should().Be(TAGReadResult.NoError); preScan.SeedLatitude.Should().Be(null); preScan.SeedLongitude.Should().Be(null); preScan.SeedHeight.Should().Be(null); preScan.SeedNorthing.Should().Be(5876814.5384829007); preScan.SeedEasting.Should().Be(7562822.7801738745); preScan.SeedElevation.Should().Be(127.31059507932183); preScan.SeedTimeUTC.Should().Be(System.DateTime.Parse("2020-06-05T23:29:53.761", System.Globalization.NumberFormatInfo.InvariantInfo)); preScan.RadioType.Should().Be("torch"); preScan.RadioSerial.Should().Be("5850F00892"); preScan.MachineType.Should().Be(MachineType.Excavator); preScan.MachineID.Should().Be("M316F PAK115"); preScan.HardwareID.Should().Be("1639J101YU"); preScan.DesignName.Should().Be("L03P"); preScan.ApplicationVersion.Should().Be("EW-1.11.0-2019_3 672"); }
/// <summary> /// reads and validates tagFile, returning model for multi-use /// </summary> public static ContractExecutionResult PreScanTagFile(TagFileDetail tagDetail, out TAGFilePreScan tagFilePreScan) { tagFilePreScan = new TAGFilePreScan(); if (tagDetail.tagFileContent.Length <= minTagFileLength) { return(new ContractExecutionResult((int)TRexTagFileResultCode.TRexInvalidTagfile, TRexTagFileResultCode.TRexInvalidTagfile.ToString())); } using (var stream = new MemoryStream(tagDetail.tagFileContent)) tagFilePreScan.Execute(stream); if (tagFilePreScan.ReadResult != TAGReadResult.NoError) { return(new ContractExecutionResult((int)TRexTagFileResultCode.TRexTagFileReaderError, tagFilePreScan.ReadResult.ToString())); } return(new ContractExecutionResult((int)TRexTagFileResultCode.Valid)); }
public async Task Test_PlatformSerialNoValidationOk() { // This test ensures platformSerialNumber (serial/deviceid) is extracted and used in validation. Note this Tagfile has no Radio Serial id. Only Serial id. var projectUid = Guid.NewGuid(); var moqRequest = new GetProjectUidsRequest(projectUid.ToString(), string.Empty, 40, 50); var moqResult = new GetProjectUidsResult(projectUid.ToString(), null, null, 0, "success"); SetupDITfa(true, moqRequest, moqResult); byte[] tagContent; using (var tagFileStream = new FileStream(Path.Combine("TestData", "TAGFiles", "2415J078SW-Serial-Test.tag"), FileMode.Open, FileAccess.Read)) { tagContent = new byte[tagFileStream.Length]; tagFileStream.Read(tagContent, 0, (int)tagFileStream.Length); } var td = new TagFileDetail() { assetId = null, projectId = null, // force validation on serial id tagFileName = "2415J078SW-Serial-Test.tag", tagFileContent = tagContent, tccOrgId = "", IsJohnDoe = false }; var tagFilePreScan = new TAGFilePreScan(); await using (var stream = new MemoryStream(td.tagFileContent)) tagFilePreScan.Execute(stream); var result = await TagfileValidator.ValidSubmission(td, tagFilePreScan).ConfigureAwait(false); Assert.True(result.Code == (int)TRexTagFileResultCode.Valid, "Failed to return a Valid request"); Assert.True(td.projectId != null, "Failed to return a Valid projectID"); Assert.Equal("success", result.Message); }
public async Task DeviceLKS_CB460_SentOk() { var projectUid = Guid.NewGuid(); SetupDIDeviceGateay(true); byte[] tagContent; using (var tagFileStream = new FileStream(Path.Combine("TestData", "TAGFiles", "TestTAGFile.tag"), FileMode.Open, FileAccess.Read)) { tagContent = new byte[tagFileStream.Length]; tagFileStream.Read(tagContent, 0, (int)tagFileStream.Length); } var td = new TagFileDetail() { assetId = null, projectId = projectUid, tagFileName = "Test.tag", tagFileContent = tagContent, tccOrgId = "", IsJohnDoe = false }; var tagFilePreScan = new TAGFilePreScan(); await using (var stream = new MemoryStream(td.tagFileContent)) tagFilePreScan.Execute(stream); Assert.NotNull(tagFilePreScan); Assert.Equal("0523J019SW", tagFilePreScan.HardwareID); var executor = new SubmitTAGFileExecutor(); executor.SendDeviceStatusToDeviceGateway(td, tagFilePreScan); }
public void Test_TAGFilePreScan_Execute_JapaneseDesign() { TAGFilePreScan preScan = new TAGFilePreScan(); Assert.True(preScan.Execute(new FileStream(Path.Combine("TestData", "TAGFiles", "JapaneseDesignTagfileTest.tag"), FileMode.Open, FileAccess.Read)), "Pre-scan execute returned false"); preScan.ProcessedEpochCount.Should().Be(1222); preScan.ReadResult.Should().Be(TAGReadResult.NoError); preScan.SeedLatitude.Should().Be(0.65955923731934751); preScan.SeedLongitude.Should().Be(2.45317108556434); preScan.SeedHeight.Should().Be(159.53982475668218); preScan.SeedNorthing.Should().Be(198863.25259713328); preScan.SeedEasting.Should().Be(63668.71188769384); preScan.SeedElevation.Should().Be(114.32995182440192); preScan.SeedTimeUTC.Should().Be(System.DateTime.Parse("2019-06-17T01:43:14.8640000", System.Globalization.NumberFormatInfo.InvariantInfo)); preScan.RadioType.Should().Be("torch"); preScan.RadioSerial.Should().Be("5750F00368"); preScan.MachineType.Should().Be(25); preScan.MachineID.Should().Be("320E03243"); preScan.HardwareID.Should().Be("3337J201SW"); preScan.DesignName.Should().Be("所沢地区 NO.210-NO.255"); preScan.ApplicationVersion.Should().Be("13.11-RC1"); }
public void Test_TAGFilePreScan_Execute() { TAGFilePreScan preScan = new TAGFilePreScan(); Assert.True(preScan.Execute(new FileStream(Path.Combine("TestData", "TAGFiles", "TestTAGFile.tag"), FileMode.Open, FileAccess.Read)), "Pre-scan execute returned false"); preScan.ProcessedEpochCount.Should().Be(1478); preScan.ReadResult.Should().Be(TAGReadResult.NoError); preScan.SeedLatitude.Should().Be(0.8551829920414814); preScan.SeedLongitude.Should().Be(-2.1377653549870974); preScan.SeedHeight.Should().Be(25.045071376845993); preScan.SeedNorthing.Should().Be(5427420.4410656113); preScan.SeedEasting.Should().Be(537671.61978842877); preScan.SeedElevation.Should().Be(41.549531624124079); preScan.SeedTimeUTC.Should().Be(System.DateTime.Parse("2014-08-26T17:40:39.3550000", System.Globalization.NumberFormatInfo.InvariantInfo)); preScan.RadioType.Should().Be("torch"); preScan.RadioSerial.Should().Be("5411502448"); preScan.MachineType.Should().Be(39); preScan.MachineID.Should().Be("CB54XW JLM00885"); preScan.HardwareID.Should().Be("0523J019SW"); preScan.DesignName.Should().Be("CAT DAY 22"); preScan.ApplicationVersion.Should().Be("12.61-75222"); }
public void Test_TAGFilePreScan_Execute_NoSeedLLH() { var preScan = new TAGFilePreScan(); Assert.True(preScan.Execute(new FileStream(Path.Combine("TestData", "TAGFiles", "TestTagFile_NoSeedLLHandNoUTM.tag"), FileMode.Open, FileAccess.Read)), "Pre-scan execute returned false"); preScan.ProcessedEpochCount.Should().Be(272); preScan.ReadResult.Should().Be(TAGReadResult.NoError); preScan.SeedLatitude.Should().BeNull(); preScan.SeedLongitude.Should().BeNull(); preScan.SeedHeight.Should().BeNull(); preScan.SeedNorthing.Should().Be(121931.74737617122); preScan.SeedEasting.Should().Be(564022.58097323333); preScan.SeedElevation.Should().Be(398.75510795260766); preScan.SeedTimeUTC.Should().Be(System.DateTime.Parse("2012-07-26T08:52:46.0350000", System.Globalization.NumberFormatInfo.InvariantInfo)); preScan.RadioType.Should().Be("torch"); preScan.RadioSerial.Should().Be("5123545219"); preScan.MachineType.Should().Be(25); preScan.MachineID.Should().Be("B LHR934 S33251"); preScan.HardwareID.Should().Be("1112J010SW"); preScan.DesignName.Should().Be("Monthey Kontaktboden C2c6"); preScan.ApplicationVersion.Should().Be("12.20-53094"); }
public async Task Test_ValidateFailed_InvalidManualProjectType() { var projectUid = Guid.NewGuid(); var moqRequest = new GetProjectUidsRequest(projectUid.ToString(), string.Empty, 0, 0); var moqResult = new GetProjectUidsResult(string.Empty, string.Empty, string.Empty, 3044, "Manual Import: cannot import to a Civil type project"); SetupDITfa(true, moqRequest, moqResult); byte[] tagContent; using (var tagFileStream = new FileStream(Path.Combine("TestData", "TAGFiles", "TestTAGFile.tag"), FileMode.Open, FileAccess.Read)) { tagContent = new byte[tagFileStream.Length]; tagFileStream.Read(tagContent, 0, (int)tagFileStream.Length); } var td = new TagFileDetail() { assetId = null, projectId = projectUid, tagFileName = "Test.tag", tagFileContent = tagContent, tccOrgId = "", IsJohnDoe = false }; var tagFilePreScan = new TAGFilePreScan(); await using (var stream = new MemoryStream(td.tagFileContent)) tagFilePreScan.Execute(stream); var result = await TagfileValidator.ValidSubmission(td, tagFilePreScan).ConfigureAwait(false); Assert.True(result.Code == 3044, "Failed to return correct error code"); Assert.Equal("Manual Import: cannot import to a Civil type project", result.Message); }
public async Task Test_UsingNEE_ValidateOk() { var projectUid = Guid.NewGuid(); var moqRequest = new GetProjectUidsRequest(projectUid.ToString(), "1639J101YU", 0, 0, 5876814.5384829007, 7562822.7801738745); var moqResult = new GetProjectUidsResult(projectUid.ToString(), string.Empty, string.Empty, 0, "success"); SetupDITfa(true, moqRequest, moqResult); byte[] tagContent; using (var tagFileStream = new FileStream(Path.Combine("TestData", "TAGFiles", "SeedPosition-usingNEE.tag"), FileMode.Open, FileAccess.Read)) { tagContent = new byte[tagFileStream.Length]; tagFileStream.Read(tagContent, 0, (int)tagFileStream.Length); } var td = new TagFileDetail() { assetId = null, projectId = projectUid, tagFileName = "Bug ccssscon-401 NEE SeedPosition.tag", tagFileContent = tagContent, tccOrgId = "", IsJohnDoe = false }; var tagFilePreScan = new TAGFilePreScan(); await using (var stream = new MemoryStream(td.tagFileContent)) tagFilePreScan.Execute(stream); var result = await TagfileValidator.ValidSubmission(td, tagFilePreScan).ConfigureAwait(false); Assert.True(result.Code == (int)TRexTagFileResultCode.Valid, "Failed to return a Valid request"); Assert.Equal("success", result.Message); }