Esempio n. 1
0
        public void Throws_if_matrix_is_null()
        {
            // Arrange
            var gl = new GroupLocator <int>(1);

            // Assert
            Assert.ThrowsException <ArgumentNullException>(() => gl.LocateGroups(null));
        }
Esempio n. 2
0
        public void Returns_empty_collection_if_matrix_is_empty()
        {
            // Arrange
            var gl          = new GroupLocator <int>(1);
            var EmptyMatrix = new int[, ] {
            };
            // Act
            List <Group> groups = gl.LocateGroups(EmptyMatrix);

            // Assert
            Assert.AreEqual(groups.Count, 0);
        }
Esempio n. 3
0
        public IActionResult Calculate([FromBody] PatientModel patients)
        {
            _logger.LogInformation("Calculating number of groups");

            var locator = new GroupLocator <int>(1);
            var groups  = locator.LocateGroups(patients.Matrix);

            var response = new Result();

            response.numberOfGroups = groups.Count;

            return(Ok(response));
        }
Esempio n. 4
0
        public void Returns_collection_of_groups_of_five()
        {
            // Arrange
            var gl            = new GroupLocator <int>(1);
            var PatientMatrix = new int[, ] {
                { 1, 1, 0, 0, 0, 0 },
                { 0, 1, 0, 0, 0, 1 },
                { 1, 0, 1, 0, 0, 0 },
                { 0, 0, 0, 0, 1, 0 },
                { 0, 0, 0, 0, 0, 1 },
                { 1, 1, 0, 1, 0, 0 }
            };

            // Act
            List <Group> groups = gl.LocateGroups(PatientMatrix);

            // Assert
            Assert.AreEqual(groups.Count, 5);
        }