示例#1
0
        public void GetFirearmIdByFullName()
        {
            long gunId = MyCollection.GetId(_databasePath, _fullName, out _errOut);

            TestContext.WriteLine($"FireArm Id from full name {_fullName} is {gunId}");
            General.HasTrueValue(gunId > 0, _errOut);
        }
示例#2
0
        public void VerifyByFullNameAndSerial()
        {
            bool value = false;
            long gunId = 0;

            try
            {
                VerifyExists();
                gunId = MyCollection.GetId(_databasePath, _fullName, out _errOut);
                if (_errOut.Length > 0)
                {
                    throw new Exception(_errOut);
                }
                value = MyCollection.Verify(_databasePath, gunId, _fullName, _serialNumber, out _errOut);
                if (_errOut.Length > 0)
                {
                    throw new Exception(_errOut);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine($"ERROR: {e.Message}");
            }

            string msg = value ? "does exists" : "does not exist";

            TestContext.WriteLine($"FireArm Id from full name {_fullName} is {gunId} and {msg}");
            General.HasTrueValue(value, _errOut);
        }
示例#3
0
 /// <summary>
 /// Verifies the does not exists.
 /// </summary>
 private void VerifyDoesNotExists()
 {
     if (MyCollection.Exists(_databasePath, _fullName, out _errOut))
     {
         long gunId = MyCollection.GetId(_databasePath, _fullName, out _errOut);
         MyCollection.Delete(_databasePath, gunId, out _errOut);
     }
 }
示例#4
0
        public void RemoveFirearm()
        {
            long gunId = MyCollection.GetId(_databasePath, _fullName, out _errOut);

            TestContext.WriteLine($"FireArm Id from full name {_fullName} is {gunId}");
            bool value = MyCollection.Delete(_databasePath, gunId, out _errOut);

            General.HasTrueValue(value, _errOut);
        }
示例#5
0
        public void UpdateFirearm()
        {
            VerifyExists();

            long gunId = MyCollection.GetId(_databasePath, _fullName, out _errOut);

            bool value = MyCollection.Update(_databasePath, (int)gunId, false, 2, _manufacturesId, "G26", _modelId, "RIA2323423", "Pistol: Semi-Auto - SA/DA", "9mm Luger", "black",
                                             "New", " ", _nationalityId, _gripId, "18oz", "4", "plastic", "5 in", " ", " ", "single", "10 round mag",
                                             "iron", "400.00", "billy bob", "500.00", " ", "MSRP", "500.00", "Safe", " ", " ", "1990", " ",
                                             DateTime.Now.ToString(CultureInfo.InvariantCulture), false, " ", "11/09/2021 14:20:45", " ", " ",
                                             true, "1-8", "1 lbs", " ", "Modern", "2021/11/02", false, false, "", "", false, false, out _errOut);

            General.HasTrueValue(value, _errOut);
        }
        public void ImportFileTest()
        {
            bool value = false;

            try
            {
                //string expectedFullName = "Glock G17 Imported unit test";
                string expectedFullName = "Glock G17 Open Class";
                if (MyCollection.Exists(_databasePath, expectedFullName, out _errOut))
                {
                    long gId = MyCollection.GetId(_databasePath, expectedFullName, out _errOut);
                    if (_errOut.Length > 0)
                    {
                        throw new Exception(_errOut);
                    }
                    if (!MyCollection.Delete(_databasePath, gId, out _errOut))
                    {
                        throw new Exception(_errOut);
                    }
                }

                if (!XmlImport.Details(_databasePath, _xmlImportFile, _ownerId, false, out _errOut))
                {
                    throw new Exception(_errOut);
                }
                long gunId = MyCollection.GetLastId(_databasePath, out _errOut);
                if (_errOut.Length > 0)
                {
                    throw new Exception(_errOut);
                }
                if (!XmlImport.Accessories(_databasePath, _xmlImportFile, gunId, out _errOut))
                {
                    throw new Exception(_errOut);
                }
                if (!XmlImport.BarrelConverstionKitDetails(_databasePath, _xmlImportFile, gunId, out _errOut))
                {
                    throw new Exception(_errOut);
                }
                if (!XmlImport.GunSmithDetails(_databasePath, _xmlImportFile, gunId, out _errOut))
                {
                    throw new Exception(_errOut);
                }
                if (!XmlImport.MaintanceDetails(_databasePath, _xmlImportFile, gunId, out _errOut))
                {
                    throw new Exception(_errOut);
                }

                List <GunCollectionList> lst = MyCollection.GetList(_databasePath, gunId, out _errOut);
                if (_errOut.Length > 0)
                {
                    throw new Exception(_errOut);
                }
                MyGunCollectionTest obj = new MyGunCollectionTest();
                obj.PrintList(lst);
                value = true;
            }
            catch (Exception e)
            {
                Console.WriteLine($"ERROR: {e.Message}");
            }
            General.HasTrueValue(value, _errOut);
        }