コード例 #1
0
        public void ShouldCreateIncidentAPITest()
        {
            string   methodName   = System.Reflection.MethodBase.GetCurrentMethod().Name;
            Incident testIncident = IncidentGenerator.GetTestIncident(methodName);
            var      controller   = new IncidentController();
            var      result       = controller.CreateIncident(testIncident);

            Assert.IsNotNull(result);
        }
コード例 #2
0
        public async Task ShouldCreateNewIncidentTest()
        {
            string   methodName   = System.Reflection.MethodInfo.GetCurrentMethod().Name;
            Incident testIncident = IncidentGenerator.GetTestIncident(methodName);
            await DocumentDBRepository <Incident> .Initialize(endpointUrl, authorizationKey, databaseId, collectionId);

            Document newIncident = await DocumentDBRepository <Incident> .CreateItemAsync(testIncident);

            Assert.IsNotNull(newIncident);
        }
コード例 #3
0
        public async Task ShouldGetAllIncidentsAPITest()
        {
            var      controller   = new IncidentController();
            string   methodName   = System.Reflection.MethodBase.GetCurrentMethod().Name;
            Incident testIncident = IncidentGenerator.GetTestIncident(methodName);
            var      result       = controller.CreateIncident(testIncident);

            Assert.IsNotNull(result);

            var incidents = await controller.GetAllIncidents();

            //Assert.AreNotEqual(0, incidents.Count);
        }
コード例 #4
0
        public void ShouldGetAllIncidentsCountAPITest()
        {
            var      controller   = new IncidentController();
            string   methodName   = System.Reflection.MethodBase.GetCurrentMethod().Name;
            Incident testIncident = IncidentGenerator.GetTestIncident(methodName);
            var      result       = controller.CreateIncident(testIncident);

            Assert.IsNotNull(result);

            var incidentCount = controller.GetIncidentCount();

            Assert.AreNotEqual(0, incidentCount);
            Console.WriteLine($"Incident count is {incidentCount}");
        }
コード例 #5
0
        public async Task ShouldGetIncidentByIdTest()
        {
            await DocumentDBRepository <Incident> .Initialize(endpointUrl, authorizationKey, databaseId, collectionId);

            string   methodName   = System.Reflection.MethodInfo.GetCurrentMethod().Name;
            Incident testIncident = IncidentGenerator.GetTestIncident(methodName);
            var      newIncident  = await DocumentDBRepository <Incident> .CreateItemAsync(testIncident);

            Assert.IsNotNull(newIncident);

            string incId         = newIncident.Id;
            var    savedIncident = await DocumentDBRepository <Incident> .GetItemAsync(incId);

            Assert.IsNotNull(savedIncident);
            Assert.AreEqual(savedIncident.Id, incId);
        }