public async Task GetLabelByIdTest()
        {
            IActionResult result = await controller.GetLabelById(1);

            OkObjectResult response = result as OkObjectResult;

            Assert.AreEqual(StatusCodes.Status200OK, (int)response.StatusCode);
        }
Ejemplo n.º 2
0
        public void GetLabelByIdTest()
        {
            var mediator            = new Mock <IMediator>();
            GetLabelByIdQuery query = new GetLabelByIdQuery
            {
                LabelId = 1
            };
            Label label = new Label()
            {
                Id = 1, Name = "Label1"
            };

            mediator.Setup(e => e.Send(query, new System.Threading.CancellationToken())).Returns(Task.FromResult(label));
            LabelController controller = new LabelController(mediator.Object);
            var             result     = controller.GetLabelById(query);
            var             response   = result.Result as OkObjectResult;

            Assert.AreEqual(label.Id, ((Label)response.Value).Id);
            Assert.AreEqual(label.Name, ((Label)response.Value).Name);
        }