예제 #1
0
        public void GetByEmptyModelTest()
        {
            var service = new SubstancesService();
            var model   = new Models.Search.QueryModel();
            var result  = service.GetByQuery(model);

            Assert.True(result.Count == 100, "return first 100 elements from db if model is empty");
        }
예제 #2
0
        public void GetReactionListOrganicTest()
        {
            var idDextrose = 2287;
            var service    = new SubstancesService();
            var reactions  = service.GetReactionList(idDextrose);

            Assert.True(reactions.Any());
            Assert.True(reactions.Count <= 100);
        }
예제 #3
0
        public void GetReactionListNonOrganicTest()
        {
            var idC       = 3180;
            var service   = new SubstancesService();
            var reactions = service.GetReactionList(idC);

            Assert.True(reactions.Any());
            Assert.True(reactions.Count <= 100);
        }
예제 #4
0
        public void GetByUnreachableVapourPressurTest()
        {
            const double VapourPressur = 0.158;
            var          service       = new SubstancesService();
            var          model         = new Models.Search.QueryModel();

            model.vp1 = VapourPressur;
            model.vp2 = 0;

            var result = service.GetByQuery(model);

            Assert.True(result.Count == 0);
        }
예제 #5
0
        public void GetByUnreachableRefractiveIndexTest()
        {
            const double RefractiveIndex = 1.329;
            var          service         = new SubstancesService();
            var          model           = new Models.Search.QueryModel();

            model.ri1 = RefractiveIndex;
            model.ri2 = 0;

            var result = service.GetByQuery(model);

            Assert.True(result.Count == 0);
        }
예제 #6
0
        public void GetByUnreachableMeltingPointTest()
        {
            const int MeltingPoint = 0;
            var       service      = new SubstancesService();
            var       model        = new Models.Search.QueryModel();

            model.mp1 = MeltingPoint;
            model.mp2 = -10;

            var result = service.GetByQuery(model);

            Assert.True(result.Count == 0);
        }
예제 #7
0
        public void GetByUnreachableFlashPointTest()
        {
            const int flashpoint = 100;
            var       service    = new SubstancesService();
            var       model      = new Models.Search.QueryModel();

            model.fp1 = flashpoint;
            model.fp2 = 0;

            var result = service.GetByQuery(model);

            Assert.True(result.Count == 0);
        }
예제 #8
0
        public void GetByUnreachableDensityTest()
        {
            const int density = 1;
            var       service = new SubstancesService();
            var       model   = new Models.Search.QueryModel();

            model.d1 = density;
            model.d2 = 0;

            var result = service.GetByQuery(model);

            Assert.True(result.Count == 0);
        }
예제 #9
0
        public void GetByWaterUnSolubilityTest()
        {
            const bool WaterSolubility = false;
            var        service         = new SubstancesService();
            var        model           = new Models.Search.QueryModel();

            model.ws = WaterSolubility;

            var result = service.GetByQuery(model);

            Assert.True(result.Count > 0);
            foreach (var previewElem in result)
            {
                var elem = service.GetById(previewElem.Id);
                Assert.True(elem.WaterSolubility == "нет");
            }
        }
예제 #10
0
        public void GetByVapourPressurLessThanTest()
        {
            const double VapourPressur = 0.158;
            var          service       = new SubstancesService();
            var          model         = new Models.Search.QueryModel();

            model.vp2 = VapourPressur;

            var result = service.GetByQuery(model);

            Assert.True(result.Count > 0);
            foreach (var previewElem in result)
            {
                var elem = service.GetById(previewElem.Id);
                Assert.True(elem.VapourPressur <= VapourPressur);
            }
        }
예제 #11
0
        public void GetByBoilingPointGreatThanTest()
        {
            const int boilingPoint = 10;
            var       service      = new SubstancesService();
            var       model        = new Models.Search.QueryModel();

            model.bp1 = boilingPoint;

            var result = service.GetByQuery(model);

            Assert.True(result.Count > 0);
            foreach (var previewElem in result)
            {
                var elem = service.GetById(previewElem.Id);
                Assert.True(elem.BoilingPoint >= boilingPoint);
            }
        }
예제 #12
0
        public void GetByMeltingPointLessThanTest()
        {
            const int MeltingPoint = 0;
            var       service      = new SubstancesService();
            var       model        = new Models.Search.QueryModel();

            model.mp2 = MeltingPoint;

            var result = service.GetByQuery(model);

            Assert.True(result.Count > 0);
            foreach (var previewElem in result)
            {
                var elem = service.GetById(previewElem.Id);
                Assert.True(elem.MeltingPoint <= MeltingPoint);
            }
        }
예제 #13
0
        public void GetByFlashPointThanTest()
        {
            const int flashpoint = 100;
            var       service    = new SubstancesService();
            var       model      = new Models.Search.QueryModel();

            model.fp1 = flashpoint;

            var result = service.GetByQuery(model);

            Assert.True(result.Count > 0);
            foreach (var previewElem in result)
            {
                var elem = service.GetById(previewElem.Id);
                Assert.True(elem.FlashPoint >= flashpoint);
            }
        }
예제 #14
0
        public void GetByDensityLessThanTest()
        {
            const int density = 1;
            var       service = new SubstancesService();
            var       model   = new Models.Search.QueryModel();

            model.d2 = density;

            var result = service.GetByQuery(model);

            Assert.True(result.Count > 0);
            foreach (var previewElem in result)
            {
                var elem = service.GetById(previewElem.Id);
                Assert.True(elem.Density <= density);
            }
        }
예제 #15
0
        public void GetByValidNameTest()
        {
            const string name    = "вода";
            var          service = new SubstancesService();
            var          model   = new Models.Search.QueryModel();

            model.q = name;

            var result = service.GetByQuery(model);

            Assert.True(result.Count > 0);
            foreach (var previewElem in result)
            {
                var elem = service.GetById(previewElem.Id);
                Assert.True(elem.Names.Any(x => x.ToLower().Contains(name)));
            }
        }
예제 #16
0
        public void GetByRefractiveIndexLessThanTest()
        {
            const double RefractiveIndex = 1.329;
            var          service         = new SubstancesService();
            var          model           = new Models.Search.QueryModel();

            model.ri2 = RefractiveIndex;

            var result = service.GetByQuery(model);

            Assert.True(result.Count > 0);
            foreach (var previewElem in result)
            {
                var elem = service.GetById(previewElem.Id);
                Assert.True(elem.RefractiveIndex <= RefractiveIndex);
            }
        }
예제 #17
0
        public void GetByValidFormulaWithDigitsTest()
        {
            const string Formula = "C28H38O19";
            var          service = new SubstancesService();
            var          model   = new Models.Search.QueryModel();

            model.q = Formula;

            var result = service.GetByQuery(model);

            Assert.True(result.Count > 0);
            foreach (var previewElem in result)
            {
                var elem = service.GetById(previewElem.Id);
                Assert.True(elem.Formula == Formula);
            }
        }
예제 #18
0
        public void GetByEqualFormulasTest()
        {
            const string Formula         = "C2H5OH";
            const string extendedFormula = "C2H5OH";
            const string foldedFormula   = "C2H6O";
            var          service         = new SubstancesService();
            var          model           = new Models.Search.QueryModel();

            model.q = Formula;

            var resultByFormula = service.GetByQuery(model);

            model.q = extendedFormula;
            var resultByExtendedFormula = service.GetByQuery(model);

            model.q = foldedFormula;
            var resultByFoldedFormula = service.GetByQuery(model);

            Assert.True(resultByFormula.Count > 0);
            Assert.True(resultByFormula.Select(x => x.Id).SequenceEqual(resultByExtendedFormula.Select(x => x.Id)));
            Assert.True(resultByFormula.Select(x => x.Id).SequenceEqual(resultByFoldedFormula.Select(x => x.Id)));
        }
예제 #19
0
        public void GetByInvalidIdTest()
        {
            var service = new SubstancesService();

            Assert.Throws <System.SystemException>(() => service.GetById(-1));
        }