public void MaxTest() { string errMsg = string.Empty; int res = 0; try { MaxModel model = new MaxModel { FloatField = 10.01f, FloatField1 = 1f, }; res = new TestLogic().MaxTest(model); } catch (Exception ex) { errMsg = ex.Message; } Assert.IsTrue(res == 100); Assert.IsTrue(string.IsNullOrEmpty(errMsg)); errMsg = string.Empty; res = 0; try { MaxModel model = new MaxModel { FloatField = 100.01f, FloatField1 = 1f, }; res = new TestLogic().MaxTest(model); } catch (Exception ex) { errMsg = ex.Message; } Assert.IsTrue(res != 100); Assert.IsTrue(!string.IsNullOrEmpty(errMsg)); /*********************************************************************************/ errMsg = string.Empty; res = 0; try { MaxModel model = new MaxModel { FloatField = 10.01f, FloatField1 = 100.01f, }; res = new TestLogic().MaxTest(model); } catch (Exception ex) { errMsg = ex.Message; } Assert.IsTrue(res == 100); Assert.IsTrue(string.IsNullOrEmpty(errMsg)); errMsg = string.Empty; res = 0; try { MaxModel model = new MaxModel { FloatField = 10.01f, FloatField1 = 1000.01f, }; res = new TestLogic().MaxTest(model); } catch (Exception ex) { errMsg = ex.Message; } Assert.IsTrue(res != 100); Assert.IsTrue(!string.IsNullOrEmpty(errMsg)); }
public int MaxTest(MaxModel model) { return(100); }