public async Task Handle_ValidatorReturnFail_Fail()
        {
            var handler = new AddFigureHandler(null, _validator);

            Result <AddFigureResponseData> result = await handler.Handle(
                new AddFigureRequest
            {
                FigureDescription = new CircleDescription {
                    Radius = -1
                },
                FigureType = "circle",
            },
                CancellationToken.None);

            Assert.True(result.Fail);
        }
        public async Task Handle_HappyPath_SavedToDb()
        {
            var queryFactoryMock = new Mock <IQueryFactory>();

            queryFactoryMock
            .Setup(x => x.SaveFigure(It.IsAny <Figure>()))
            .Returns(Task.FromResult(1L));

            var handler = new AddFigureHandler(queryFactoryMock.Object, _validator);

            Result <AddFigureResponseData> result = await handler.Handle(
                new AddFigureRequest
            {
                FigureDescription = new CircleDescription {
                    Radius = 1
                },
                FigureType = "circle",
            },
                CancellationToken.None);

            queryFactoryMock.Verify(x => x.SaveFigure(It.IsAny <Figure>()), Times.Once);
        }
        public async Task Handle_HappyPath_ReturnId()
        {
            long id = 1;

            var queryFactoryMock = new Mock <IQueryFactory>();

            queryFactoryMock
            .Setup(x => x.SaveFigure(It.IsAny <Figure>()))
            .Returns(Task.FromResult(id));

            var handler = new AddFigureHandler(queryFactoryMock.Object, _validator);

            Result <AddFigureResponseData> result = await handler.Handle(
                new AddFigureRequest
            {
                FigureDescription = new CircleDescription {
                    Radius = 1
                },
                FigureType = "circle",
            },
                CancellationToken.None);

            Assert.AreEqual(id, result.Data.FigureId);
        }