public void ReglerS2NichtDa() { MaterialMatrix avaiMat = new MaterialMatrix(100); avaiMat[3, 38] = 0; string[] obj = new string[20]; for (int cnt = 0; cnt < obj.Length; cnt++) { obj[cnt] = "testStr_" + cnt; } obj[0] = "D"; obj[7] = "HP"; obj[8] = "R"; obj[9] = "15"; obj[10] = "A7"; obj[11] = "RKP"; obj[12] = "063"; obj[13] = "K"; obj[14] = "M"; obj[15] = "18"; obj[16] = "S2"; obj[17] = "Z"; obj[18] = "11"; obj[19] = ""; Assert.IsFalse(AvailabilityCheck.IsAvailable(obj, avaiMat)); }
public void GehauseDS1NichtDa() { MaterialMatrix avaiMat = new MaterialMatrix(100); avaiMat[1, 1] = 0; string[] obj = new string[50]; for (int cnt = 0; cnt < obj.Length; cnt++) { obj[cnt] = "testStr_" + cnt; } obj[0] = "D"; obj[7] = "HK"; obj[8] = "R"; obj[9] = "14"; obj[10] = "A7"; obj[11] = "RKP"; obj[12] = "032"; obj[13] = "H"; obj[14] = "M"; obj[15] = "35"; obj[16] = "D1"; obj[17] = "Z"; obj[18] = "00"; obj[19] = "DS1"; obj[20] = ""; Assert.IsFalse(AvailabilityCheck.IsAvailable(obj, avaiMat)); }
public void UnvalidKey5() { MaterialMatrix avaiMat = new MaterialMatrix(100); string[] obj = new string[50]; for (int cnt = 0; cnt < obj.Length; cnt++) { obj[cnt] = "testStr_" + cnt; } obj[0] = "D"; obj[7] = "HK"; obj[8] = "R"; obj[9] = "14"; obj[10] = "A7"; obj[11] = "RKP"; obj[12] = "063"; obj[13] = "H"; obj[14] = "M"; obj[15] = "35"; obj[16] = "D1"; obj[17] = "Z"; obj[18] = "00"; obj[19] = "RKP"; obj[20] = "019"; obj[21] = "H"; obj[22] = "M"; obj[23] = "35"; obj[24] = "D3"; obj[25] = "Z"; obj[26] = "00"; obj[27] = ""; Assert.IsFalse(AvailabilityCheck.IsAvailable(obj, avaiMat)); }
public void DeckelHFCB1Da() { MaterialMatrix avaiMat = new MaterialMatrix(); avaiMat[3, 1] = 1; avaiMat[3, 19] = 1; avaiMat[3, 40] = 1; string[] obj = new string[50]; for (int cnt = 0; cnt < obj.Length; cnt++) { obj[cnt] = "testStr_" + cnt; } obj[0] = "D"; obj[7] = "HK"; obj[8] = "R"; obj[9] = "14"; obj[10] = "B1"; obj[11] = "RKP"; obj[12] = "063"; obj[13] = "H"; obj[14] = "C"; obj[15] = "35"; obj[16] = "S1"; obj[17] = "Z"; obj[18] = "00"; obj[19] = "DS1"; obj[20] = ""; Assert.IsTrue(AvailabilityCheck.IsAvailable(obj, avaiMat)); }
static int Main(string[] args) { if (args.Length != 3) { Console.Error.WriteLine("Wrong number of Arguments"); Console.Error.WriteLine("Usage: RkpCli <sql_host> <depmatrix_csv_file> <article_num>"); return(1); } else { try { var sql = new MySQLArticleClient(args[0]); var mat = MaterialMatrix.ReadFromFile(args[1]); // todo get productkey string[] productkey = sql.GetProductkey(args[2]); if (productkey == null) { Console.Error.WriteLine("Article not found"); return(2); } Console.WriteLine((AvailabilityCheck.IsAvailable(productkey, mat) ? 1 : 0)); return(0); } catch (Exception exc) { Console.Error.WriteLine(exc); return(3); } } }
static AvailabilityCheckTest() { ConstructorArgumentValidationTestScenarios .RemoveAllScenarios() .AddScenario(() => new ConstructorArgumentValidationTestScenario <AvailabilityCheck> { Name = "constructor should throw ArgumentNullException when parameter 'operation' is null scenario", ConstructionFunc = () => { var referenceObject = A.Dummy <AvailabilityCheck>(); var result = new AvailabilityCheck( null, referenceObject.MessageFormatKind, referenceObject.Details); return(result); }, ExpectedExceptionType = typeof(ArgumentNullException), ExpectedExceptionMessageContains = new[] { "operation", }, }) .AddScenario(() => new ConstructorArgumentValidationTestScenario <AvailabilityCheck> { Name = "constructor should throw ArgumentOutOfRangeException when parameter 'messageFormatKind' is MessageFormatKind.Unknown", ConstructionFunc = () => { var referenceObject = A.Dummy <AvailabilityCheck>(); var result = new AvailabilityCheck( referenceObject.Operation, MessageFormatKind.Unknown, null); return(result); }, ExpectedExceptionType = typeof(ArgumentOutOfRangeException), ExpectedExceptionMessageContains = new[] { "messageFormatKind is MessageFormatKind.Unknown", }, }); }
public void Lagerdeckel1DoppelDa() { MaterialMatrix avaiMat = new MaterialMatrix(); avaiMat[3, 1] = 1; avaiMat[3, 14] = 1; avaiMat[3, 33] = 1; avaiMat[0, 0] = 1; avaiMat[0, 16] = 1; avaiMat[0, 30] = 1; string[] obj = new string[50]; for (int cnt = 0; cnt < obj.Length; cnt++) { obj[cnt] = "testStr_" + cnt; } obj[0] = "D"; obj[7] = "HK"; obj[8] = "R"; obj[9] = "14"; obj[10] = "A7"; obj[11] = "RKP"; obj[12] = "063"; obj[13] = "H"; obj[14] = "M"; obj[15] = "35"; obj[16] = "D1"; obj[17] = "Z"; obj[18] = "00"; obj[19] = "RKP"; obj[20] = "019"; obj[21] = "H"; obj[22] = "M"; obj[23] = "35"; obj[24] = "C1"; obj[25] = "Z"; obj[26] = "00"; obj[27] = ""; Assert.IsTrue(AvailabilityCheck.IsAvailable(obj, avaiMat)); }