Пример #1
0
        public void GetOfficerShootingsTest()
        {
            // Arrange
            CmpdEntities context = GetOfficerShootings();
            OfficerShootingsController controller = new OfficerShootingsController(context)
            {
                Request       = new HttpRequestMessage(),
                Configuration = new HttpConfiguration()
            };

            // Act
            var response = controller.GetOfficerShootings()
                           as OkNegotiatedContentResult <List <GetOfficerShootings_Result> >;

            var shooting = response.Content.First();

            // Assert
            Assert.IsNotNull(response);
            Assert.IsNotNull(shooting);
        }
Пример #2
0
        public void GetOfficerShootingsTest1()
        {
            // Arrange
            String       startDate = "1/1/2016";
            String       endDate   = "12/31/2016";
            CmpdEntities context   = new CmpdEntities();
            List <GetOfficerShootings_Result> db = context.GetOfficerShootings();

            OfficerShootingsController controller = new OfficerShootingsController(context)
            {
                Request       = new HttpRequestMessage(),
                Configuration = new HttpConfiguration()
            };


            // Act
            var response = controller.GetOfficerShootings(startDate, endDate)
                           as OkNegotiatedContentResult <List <GetOfficerShootings_Result> >;

            // Assert
            Assert.IsNotNull(response);
            Assert.IsFalse(response.Content.Exists(s => s.YR != 2016));
        }
Пример #3
0
        public void GetOfficerShootingsById()
        {
            // Arrange
            int          id      = 7307;
            CmpdEntities context = GetOfficerShootings();
            List <GetOfficerShootings_Result> db = context.GetOfficerShootings();

            OfficerShootingsController controller = new OfficerShootingsController(context)
            {
                Request       = new HttpRequestMessage(),
                Configuration = new HttpConfiguration()
            };

            // Act
            var response = controller.GetOfficerShootings(id)
                           as OkNegotiatedContentResult <GetOfficerShootings_Result>;

            var shooting = db.Find(s => s.INCIDENT_ID == id);

            // Assert
            Assert.IsNotNull(response);
            Assert.AreEqual(shooting.INCIDENT_ID, response.Content.INCIDENT_ID);
        }