Esempio n. 1
0
        public async Task GetAreaByIdAsync_ValidData_OkAsync(ShapeType type, bool enable, long? x, long? y, long? z, long? radius, double expected)
        {
            await using var context = new SqliteContext();
            var target = new ShapeService(context);

            var request = new ShapeDto
            {
                Type = type,
                RadiusEnabled = enable,
                X = x,
                Y = y,
                Z = z,
                Radius = radius
            };
            var shapeId = await target.CreateAsync(request);

            var area = await target.GetAreaByIdAsync(shapeId);

            Assert.Equal(expected, area);
        }
Esempio n. 2
0
        public async Task CreateAsync_ValidData_OkAsync(ShapeType type, bool enable, long? x, long? y, long? z, long? radius = null)
        {
            await using var context = new SqliteContext();
            var target = new ShapeService(context);

            var request = new ShapeDto
            {
                Type = type,
                RadiusEnabled = enable,
                X = x,
                Y = y,
                Z = z,
                Radius = radius
            };
            var shape = await context.Shapes.ByIdOrFailAsync(await target.CreateAsync(request));

            Assert.Equal(x, shape.X);
            Assert.Equal(y, shape.Y);
            Assert.Equal(z, shape.Z);
            Assert.Equal(radius, shape.Radius);
        }