예제 #1
0
        public async Task GetAllLabelsAsync_Given_Labels_Exist_Should_Return_List_Off_Labels()
        {
            IEnumerable <Label> labels = new List <Label>()
            {
                new Label(),
                new Label(),
                new Label(),
                new Label()
            };

            mongoDBPersistance
            .Setup(s => s.FindAllLabelsAsync())
            .Returns(Task.FromResult(labels));

            var retval = await _labelManager.GetAllLabelsAsync();

            Assert.IsNotNull(retval);
        }
예제 #2
0
        public async Task <IActionResult> GetLabelsAsync()
        {
            logger.LogInformation($"GetLabels - Resource Requested.");

            var labels = await labelManager.GetAllLabelsAsync();

            if (labels != null)
            {
                return(Ok(labels));
            }

            return(NotFound());
        }