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"); }
public void GetReactionListOrganicTest() { var idDextrose = 2287; var service = new SubstancesService(); var reactions = service.GetReactionList(idDextrose); Assert.True(reactions.Any()); Assert.True(reactions.Count <= 100); }
public void GetReactionListNonOrganicTest() { var idC = 3180; var service = new SubstancesService(); var reactions = service.GetReactionList(idC); Assert.True(reactions.Any()); Assert.True(reactions.Count <= 100); }
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); }
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); }
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); }
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); }
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); }
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 == "нет"); } }
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); } }
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); } }
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); } }
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); } }
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); } }
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))); } }
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); } }
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); } }
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))); }
public void GetByInvalidIdTest() { var service = new SubstancesService(); Assert.Throws <System.SystemException>(() => service.GetById(-1)); }