コード例 #1
0
        public void CalculateTriangleShouldReturnRectangledTriangle()
        {
            var queryable = Enumerable.Empty<Triangle>().AsQueryable();
            mock.Setup(x => x.FindBy(It.IsAny<Expression<Func<Triangle, bool>>>())).Returns(queryable);
            var triangleBusiness = new TriangleBusinessImpl(mock.Object);

            var result = triangleBusiness.CheckTriangle(3, 4, 5);
            Assert.AreEqual("Rectangled Triangle", result);
        }
コード例 #2
0
        public void GetTriangleFromDatabaseShouldReturnIsoscelesTriangle()
        {
            var queryable = new List<Triangle>
                                {
                                    new Triangle { SideA = 2, SideB = 2, SideC = 3, TriangleType = "Isosceles Triangle" }
                                };
            mock.Setup(x => x.FindBy(It.IsAny<Expression<Func<Triangle, bool>>>())).Returns(queryable.AsQueryable());
            var triangleBusiness = new TriangleBusinessImpl(mock.Object);

            var result = triangleBusiness.CheckTriangle(2, 2, 3);
            Assert.AreEqual("Isosceles Triangle", result);
        }
コード例 #3
0
 public void InvalidInputShouldReturnInvalidInputException()
 {
     var triangleBusiness = new TriangleBusinessImpl(mock.Object);
     var result = triangleBusiness.CheckTriangle(-1, 3, 4);
 }