コード例 #1
0
        public void ScaleneTriangleTestMethod()
        {
            var expected = TriangleType.Scalene;
            var actual   = TrianglesManager.GetType(1, 2, 5);

            Assert.AreEqual(expected, actual);
        }
コード例 #2
0
        public void EquilateralTriangleTestMethod()
        {
            var expected = TriangleType.Equilateral;
            var actual   = TrianglesManager.GetType(1, 1, 1);

            Assert.AreEqual(expected, actual);
        }
コード例 #3
0
 public WhatShapeIsThisResponse WhatShapeIsThis(WhatShapeIsThisRequest request)
 {
     if (request == null)
     {
         throw new FaultException <ArgumentNullException>(new ArgumentNullException("request"), "null arguments are invalid");
     }
     return(new WhatShapeIsThisResponse(TrianglesManager.GetType(request.a, request.b, request.c)));
 }
コード例 #4
0
        public void IsoscelesTriangleTestMethod()
        {
            var expected = TriangleType.Isosceles;
            var actual   = TrianglesManager.GetType(1, 1, 5);

            Assert.AreEqual(expected, actual);

            actual = TrianglesManager.GetType(1, 5, 5);
            Assert.AreEqual(expected, actual);

            actual = TrianglesManager.GetType(5, 6, 5);
            Assert.AreEqual(expected, actual);
        }
コード例 #5
0
        public void TriangleInvalidParamsTestMethod()
        {
            var expected = TriangleType.Error;
            var actual   = TrianglesManager.GetType(-1, 1, 1);

            Assert.AreEqual(expected, actual);

            actual = TrianglesManager.GetType(1, 0, 1);
            Assert.AreEqual(expected, actual);

            actual = TrianglesManager.GetType(1, 1, -1);
            Assert.AreEqual(expected, actual);
        }
コード例 #6
0
 public async Task <WhatShapeIsThisResponse> WhatShapeIsThisAsync(WhatShapeIsThisRequest request)
 {
     if (request == null)
     {
         throw new FaultException <ArgumentNullException>(new ArgumentNullException("request"), "null arguments are invalid");
     }
     return(await Task.Run <WhatShapeIsThisResponse>(() =>
                                                     new WhatShapeIsThisResponse(TrianglesManager.GetType(request.a, request.b, request.c))
                                                     ));
 }