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);
        }
        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);
        }
        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);
        }