Пример #1
0
        public async Task TestGetGrapData()
        {
            string          sessionid       = Guid.NewGuid().ToString();
            var             context         = new UnitTestContext();
            GraphRepository graphRepository = new GraphRepository(context);

            context.GraphSessions.Add(GetTestGraphData(sessionid));
            var controller = new GraphController(graphRepository, _logger);
            var result     = await controller.Get(sessionid) as OkNegotiatedContentResult <List <GraphData> >;

            Assert.IsNotNull(result);
            Assert.AreEqual(sessionid, result.Content[0].SessionID);
        }
Пример #2
0
        public async Task TestPostGraphData()
        {
            var             context           = new UnitTestContext();
            GraphRepository graphRepository   = new GraphRepository(context);
            var             controller        = new GraphController(graphRepository, _logger);
            var             controllerContext = Create("Graphfile.txt");

            controller.ControllerContext = controllerContext;

            var result =
                await controller.Post() as CreatedAtRouteNegotiatedContentResult <List <GraphData> >;

            Assert.IsNotNull(result);
            Assert.AreEqual(result.RouteName, "DefaultApi");
            Assert.AreEqual(context.GraphSessions.Local.Count, result.Content.Count);
        }