public void TestActionFakeHandlerSelectById()
        {
            var          uobj      = new UnitTestForApiController();
            var          testobj   = uobj.GetsecuritiesMfsList();
            MemoryStream stream    = new MemoryStream();
            IFormatter   formatter = new BinaryFormatter();

            formatter.Serialize(stream, testobj);
            var response = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StreamContent(stream)
            };

            using (var httpClient = new HttpClient(new FakeHandler
            {
                Response = response,
                InnerHandler = new HttpClientHandler()
            }))
            {
                System.Uri uri = new System.Uri("http://localhost:55893/api/");
                httpClient.BaseAddress = uri;
                var controller = new SecuritiesMfMvcController(httpClient);
                var result     = controller.Select(2155) as ViewResult;
                Assert.IsNotNull(result);
                Assert.AreEqual(result.ViewName, "Select");
            }
        }
        private string GenerateJsonArrayofSecurityMf()
        {
            var uobj    = new UnitTestForApiController();
            var testobj = uobj.GetsecuritiesMfsList();
            var jobj    = JsonConvert.SerializeObject(testobj);

            return(jobj);
        }
        public void TestActionListAll()
        {
            var uobj = new UnitTestForApiController();
            var testobj = uobj.GetsecuritiesMfsList();

            var responseMessage = new HttpResponseMessage
            {
                Content = new FakeHttpContent(testobj)
            };
            var messageHandler = new FakeHttpMessageHandler(responseMessage);
            HttpServer server = new HttpServer(messageHandler);
            using (var client = new HttpClient(new InMemoryHttpContentSerializationHandler(server)))
            {
                var uri = new System.Uri("http://localhost:55893/api/");
                client.BaseAddress = uri;
                var controller = new SecuritiesMfMvcController(client);
                var result = controller.Listall();
                Assert.IsNotNull(result);
            }
        }
        public void TestActionListAll()
        {
            var uobj    = new UnitTestForApiController();
            var testobj = uobj.GetsecuritiesMfsList();

            var responseMessage = new HttpResponseMessage
            {
                Content = new FakeHttpContent(testobj)
            };
            var        messageHandler = new FakeHttpMessageHandler(responseMessage);
            HttpServer server         = new HttpServer(messageHandler);

            using (var client = new HttpClient(new InMemoryHttpContentSerializationHandler(server)))
            {
                var uri = new System.Uri("http://localhost:55893/api/");
                client.BaseAddress = uri;
                var controller = new SecuritiesMfMvcController(client);
                var result     = controller.Listall();
                Assert.IsNotNull(result);
            }
        }
        public void TestActionFakeHandlerSelectById()
        {
            var uobj = new UnitTestForApiController();
            var testobj= uobj.GetsecuritiesMfsList();
            MemoryStream stream = new MemoryStream();
            IFormatter formatter = new BinaryFormatter();
            formatter.Serialize(stream, testobj);
            var response = new HttpResponseMessage(HttpStatusCode.OK)
            {Content = new StreamContent(stream)};

            using (var httpClient = new HttpClient(new FakeHandler
            {
                Response = response,
                InnerHandler = new HttpClientHandler()
            }))
            {
                System.Uri uri = new System.Uri("http://localhost:55893/api/");
                httpClient.BaseAddress = uri;
                var controller = new SecuritiesMfMvcController(httpClient);
                var result = controller.Select(2155) as ViewResult;
                Assert.IsNotNull(result);
                Assert.AreEqual(result.ViewName,"Select");
            }
        }
 private string GenerateJsonArrayofSecurityMf()
 {
     var uobj = new UnitTestForApiController();
     var testobj= uobj.GetsecuritiesMfsList();
     var jobj = JsonConvert.SerializeObject(testobj);
     return jobj;
 }