Ejemplo n.º 1
0
        public async Task CreatePlant()
        {
            await using var context = DatabaseHelper.CreateInMemoryDatabaseContext(nameof(CreatePlant));

            // create plant species
            var plantSpecies1 = ValidObjectHelper.ValidPlantSpecies();
            await context.PlantSpecies.AddRangeAsync(
                plantSpecies1
                );

            await context.SaveChangesAsync();

            var validPlant = ValidObjectHelper.ValidPlant(plantSpecies1);
            var id         = validPlant.Id;
            var name       = validPlant.Name;
            var cntBefore  = await context.Plants.CountAsync();

            var createCmd = new CreatePlantCommand {
                Id = id, Name = name, PlantSpeciesId = plantSpecies1.Id
            };
            var cmdHandler = new CreatePlantCommandHandler(context);
            var result     = await cmdHandler.Handle(createCmd, CancellationToken.None);

            Assert.True(result.Success);
            Assert.Equal(cntBefore + 1, await context.Plants.CountAsync());
            var obj = await context.Plants.FindAsync(id);

            Assert.Equal(id, obj.Id);
            Assert.Equal(name, obj.Name);
            Assert.Equal(plantSpecies1.Id, obj.PlantSpeciesId);
        }
Ejemplo n.º 2
0
        public async Task DeletePlant()
        {
            await using var context = DatabaseHelper.CreateInMemoryDatabaseContext(nameof(DeletePlant));
            var plantSpecies1 = ValidObjectHelper.ValidPlantSpecies();
            await context.PlantSpecies.AddAsync(
                plantSpecies1
                );

            var validPlant = ValidObjectHelper.ValidPlant(plantSpecies1);
            await context.Plants.AddAsync(validPlant);

            await context.SaveChangesAsync();

            var id        = validPlant.Id;
            var deleteCmd = new DeletePlantCommand {
                Id = id
            };
            var deleteHandler = new DeletePlantCommandHandler(context);
            var deleteResult  = await deleteHandler.Handle(deleteCmd, CancellationToken.None);

            Assert.True(deleteResult.Success);
            Assert.Empty(context.Plants);

            var deleteResult2 = await deleteHandler.Handle(deleteCmd, CancellationToken.None);

            Assert.False(deleteResult2.Success);
        }
        public async Task GetSinglePlantSpecies()
        {
            var species = ValidObjectHelper.ValidPlantSpecies();
            var id      = species.Id;
            var name    = species.Name;

            await using var context = DatabaseHelper.CreateInMemoryDatabaseContext(nameof(GetSinglePlantSpecies));
            await context.PlantSpecies.AddAsync(new PlantSpecies { Id = id, Name = name });

            await context.SaveChangesAsync();

            var querySingle = new GetPlantSpeciesByIdQuery {
                Id = id
            };
            var queryHandler = new GetPlantSpeciesByIdQueryHandler(context);
            var result       = await queryHandler.Handle(querySingle, CancellationToken.None);

            Assert.True(result.Success);
            Assert.Equal(id, result.Data.Id);
            Assert.Equal(name, result.Data.Name);

            var queryNonExisting = new GetPlantSpeciesByIdQuery {
                Id = Guid.NewGuid()
            };
            var resultNonExisting = await queryHandler.Handle(queryNonExisting, CancellationToken.None);

            Assert.False(resultNonExisting.Success);
        }
Ejemplo n.º 4
0
        public async Task UpdatePlant()
        {
            await using var context = DatabaseHelper.CreateInMemoryDatabaseContext(nameof(UpdatePlant));
            var plantSpecies1 = ValidObjectHelper.ValidPlantSpecies();
            await context.PlantSpecies.AddAsync(
                plantSpecies1
                );

            var validPlant = ValidObjectHelper.ValidPlant(plantSpecies1);
            await context.Plants.AddAsync(validPlant);

            await context.SaveChangesAsync();

            var          id        = validPlant.Id;
            const string name      = "New name :)";
            var          cntBefore = await context.Plants.CountAsync();

            var updateCmd = new UpdatePlantCommand
            {
                Id = validPlant.Id, Name = name, IsActive = true, PlantSpeciesId = plantSpecies1.Id
            };
            var cmdHandler = new UpdatePlantCommandHandler(context);
            var result     = await cmdHandler.Handle(updateCmd, CancellationToken.None);

            Assert.True(result.Success);
            Assert.Equal(cntBefore, await context.Plants.CountAsync());
            var obj = await context.Plants.FindAsync(id);

            Assert.Equal(id, obj.Id);
            Assert.Equal(name, obj.Name);
            Assert.Equal(PlantState.Active, obj.PlantState);
            Assert.Equal(plantSpecies1.Id, obj.PlantSpeciesId);

            var updateCmd2 = new UpdatePlantCommand
            {
                Id = validPlant.Id, Name = name, IsActive = false, PlantSpeciesId = plantSpecies1.Id
            };
            var result2 = await cmdHandler.Handle(updateCmd2, CancellationToken.None);

            Assert.True(result2.Success);
            Assert.Equal(cntBefore, await context.Plants.CountAsync());
            obj = await context.Plants.FindAsync(id);

            Assert.Equal(id, obj.Id);
            Assert.Equal(name, obj.Name);
            Assert.Equal(PlantState.Inactive, obj.PlantState);
            Assert.Equal(plantSpecies1.Id, obj.PlantSpeciesId);

            var updateInvalidPlantCmd = new UpdatePlantCommand
            {
                Id = Guid.NewGuid(), Name = name, IsActive = false, PlantSpeciesId = plantSpecies1.Id
            };
            var result3 = await cmdHandler.Handle(updateInvalidPlantCmd, CancellationToken.None);

            Assert.False(result3.Success);
        }
Ejemplo n.º 5
0
        public PlantLogQueryTestsFixture()
        {
            context      = DatabaseHelper.CreateInMemoryDatabaseContext(nameof(PlantLogQueryTests));
            logType1     = ValidObjectHelper.ValidPlantLogType();
            logType2     = ValidObjectHelper.ValidPlantLogType();
            plantSpecies = ValidObjectHelper.ValidPlantSpecies();
            plant1       = ValidObjectHelper.ValidPlant(plantSpecies);
            plant2       = ValidObjectHelper.ValidPlant(plantSpecies);

            var id1 = Guid.NewGuid();
            var id2 = Guid.NewGuid();
            var id3 = Guid.NewGuid();
            var id4 = Guid.NewGuid();
            var id5 = Guid.NewGuid();

            var log1 = "Hello";
            var log2 = "World";
            var log3 = "ab";
            var log4 = "world Hello abcdefgh";
            var log5 = "Töster";

            var dt1 = new DateTime(2020, 01, 01, 00, 00, 00);
            var dt2 = new DateTime(2020, 01, 01, 18, 00, 00);
            var dt3 = new DateTime(2020, 01, 02, 12, 00, 00);
            var dt4 = new DateTime(2020, 02, 01, 12, 00, 00);
            var dt5 = new DateTime(2019, 01, 01, 12, 00, 00);

            plantLog1 = new PlantLog {
                Id = id1, DateTime = dt1, Log = log1, Plant = plant1, PlantLogType = logType1
            };
            plantLog2 = new PlantLog {
                Id = id2, DateTime = dt2, Log = log2, Plant = plant1, PlantLogType = logType1
            };
            plantLog3 = new PlantLog {
                Id = id3, DateTime = dt3, Log = log3, Plant = plant2, PlantLogType = logType2
            };
            plantLog4 = new PlantLog {
                Id = id4, DateTime = dt4, Log = log4, Plant = plant2, PlantLogType = logType2
            };
            plantLog5 = new PlantLog {
                Id = id5, DateTime = dt5, Log = log5, Plant = plant2, PlantLogType = logType1
            };

            context.AddRange(logType1, logType2, plantSpecies, plant1, plant2, plantLog1, plantLog2, plantLog3, plantLog4, plantLog5);
            context.SaveChanges();
        }
Ejemplo n.º 6
0
        public async Task CreatePlantLogForPlant()
        {
            await using var context = DatabaseHelper.CreateInMemoryDatabaseContext(nameof(CreatePlantLogForPlant));

            var logType      = ValidObjectHelper.ValidPlantLogType();
            var plantSpecies = ValidObjectHelper.ValidPlantSpecies();
            var plant1       = ValidObjectHelper.ValidPlant(plantSpecies);
            await context.AddRangeAsync(logType, plantSpecies, plant1);

            await context.SaveChangesAsync();

            var validPlantLog = ValidObjectHelper.ValidPlantLog(plant1, logType);
            var id            = validPlantLog.Id;
            var plantId       = validPlantLog.PlantId;
            var logTypeId     = validPlantLog.PlantLogTypeId;
            var dateTime      = validPlantLog.DateTime;
            var log           = validPlantLog.Log;

            var cntBefore = await context.PlantLogs.CountAsync();

            var createCmd = new CreatePlantLogForPlantCommand {
                Id = id, Log = log, DateTime = dateTime, PlantId = plantId, PlantLogTypeId = logTypeId
            };
            var cmdHandler = new CreatePlantLogForPlantCommandHandler(context);
            var result     = await cmdHandler.Handle(createCmd, CancellationToken.None);

            Assert.True(result.Success);
            Assert.Equal(cntBefore + 1, await context.PlantLogs.CountAsync());
            var obj = await context.PlantLogs.FindAsync(id);

            Assert.Equal(id, obj.Id);
            Assert.Equal(plantId, obj.PlantId);
            Assert.Equal(logTypeId, obj.PlantLogTypeId);
            Assert.Equal(dateTime, obj.DateTime);
            Assert.Equal(log, obj.Log);
            var createCmdInvalidPlant = new CreatePlantLogForPlantCommand {
                Id = Guid.NewGuid(), PlantId = Guid.NewGuid(), Log = log, DateTime = dateTime, PlantLogTypeId = logTypeId
            };
            var res2 = await cmdHandler.Handle(createCmdInvalidPlant, CancellationToken.None);

            Assert.False(res2.Success);
        }
Ejemplo n.º 7
0
        public async Task GetSinglePlantLogForPlantTest()
        {
            await using var context = DatabaseHelper.CreateInMemoryDatabaseContext(nameof(GetSinglePlantLogForPlantTest));
            var logType      = ValidObjectHelper.ValidPlantLogType();
            var plantSpecies = ValidObjectHelper.ValidPlantSpecies();
            var plant1       = ValidObjectHelper.ValidPlant(plantSpecies);
            var plant2       = ValidObjectHelper.ValidPlant(plantSpecies);
            var logPlant1    = ValidObjectHelper.ValidPlantLog(plant1, logType);
            var logPlant2    = ValidObjectHelper.ValidPlantLog(plant2, logType);
            await context.AddRangeAsync(logType, plantSpecies, plant1, plant2, logPlant1, logPlant2);

            await context.SaveChangesAsync();

            var querySingle = new GetPlantLogForPlantByIdQuery {
                Id = logPlant1.Id, PlantId = plant1.Id
            };
            var queryHandler = new GetPlantLogForPlantByIdQueryHandler(context);
            var result       = await queryHandler.Handle(querySingle, CancellationToken.None);

            Assert.True(result.Success);
            Assert.Equal(logPlant1.Id, result.Data.Id);
            Assert.Equal(logPlant1.PlantId, result.Data.PlantId);
            Assert.Equal(logPlant1.PlantLogTypeId, result.Data.PlantLogTypeId);
            Assert.Equal(logPlant1.DateTime, result.Data.DateTime);
            Assert.Equal(logPlant1.Log, result.Data.Log);

            var querySingleWrongPlant = new GetPlantLogForPlantByIdQuery {
                Id = logPlant1.Id, PlantId = plant2.Id
            };
            var result2 = await queryHandler.Handle(querySingleWrongPlant, CancellationToken.None);

            Assert.False(result2.Success);

            var queryNonExisting = new GetPlantLogForPlantByIdQuery {
                Id = Guid.NewGuid(), PlantId = plant2.Id
            };
            var resultNonExisting = await queryHandler.Handle(queryNonExisting, CancellationToken.None);

            Assert.False(resultNonExisting.Success);
        }
        public async Task CreatePlantSpecies()
        {
            await using var context = DatabaseHelper.CreateInMemoryDatabaseContext(nameof(CreatePlantSpecies));

            var validSpecies = ValidObjectHelper.ValidPlantSpecies();
            var id           = validSpecies.Id;
            var name         = validSpecies.Name;
            var cntBefore    = await context.PlantSpecies.CountAsync();

            var createCmd = new CreatePlantSpeciesCommand {
                Id = id, Name = name
            };
            var cmdHandler = new CreatePlantSpeciesCommandHandler(context);
            var result     = await cmdHandler.Handle(createCmd, CancellationToken.None);

            Assert.True(result.Success);
            Assert.Equal(cntBefore + 1, await context.PlantSpecies.CountAsync());
            var obj = await context.PlantSpecies.FindAsync(id);

            Assert.Equal(id, obj.Id);
            Assert.Equal(name, obj.Name);
        }
Ejemplo n.º 9
0
        public async Task GetSinglePlant()
        {
            await using var context = DatabaseHelper.CreateInMemoryDatabaseContext(nameof(GetSinglePlant));
            var plantSpecies1 = ValidObjectHelper.ValidPlantSpecies();
            await context.PlantSpecies.AddAsync(
                plantSpecies1
                );

            var validPlant = ValidObjectHelper.ValidPlant(plantSpecies1);
            await context.Plants.AddAsync(validPlant);

            await context.SaveChangesAsync();

            var id        = validPlant.Id;
            var name      = validPlant.Name;
            var active    = validPlant.PlantState == PlantState.Active;
            var speciesId = validPlant.PlantSpeciesId;

            var querySingle = new GetPlantByIdQuery {
                Id = id
            };
            var queryHandler = new GetPlantByIdQueryHandler(context);
            var result       = await queryHandler.Handle(querySingle, CancellationToken.None);

            Assert.True(result.Success);
            Assert.Equal(id, result.Data.Id);
            Assert.Equal(name, result.Data.Name);
            Assert.Equal(active, result.Data.IsActive);
            Assert.Equal(speciesId, result.Data.PlantSpeciesId);

            var queryNonExisting = new GetPlantByIdQuery {
                Id = Guid.NewGuid()
            };
            var resultNonExisting = await queryHandler.Handle(queryNonExisting, CancellationToken.None);

            Assert.False(resultNonExisting.Success);
        }
Ejemplo n.º 10
0
        public async Task TestUpdateForPlantValidator()
        {
            await using var context = DatabaseHelper.CreateInMemoryDatabaseContext(nameof(TestUpdateForPlantValidator));
            // setup
            var logType      = ValidObjectHelper.ValidPlantLogType();
            var plantSpecies = ValidObjectHelper.ValidPlantSpecies();
            var plant1       = ValidObjectHelper.ValidPlant(plantSpecies);
            var plant2       = ValidObjectHelper.ValidPlant(plantSpecies);
            var logPlant1    = ValidObjectHelper.ValidPlantLog(plant1, logType);
            var logPlant2    = ValidObjectHelper.ValidPlantLog(plant2, logType);
            await context.AddRangeAsync(logType, plantSpecies, plant1, plant2, logPlant1, logPlant2);

            await context.SaveChangesAsync();


            var validator   = new UpdatePlantLogForPlantCommandValidator(context);
            var updateValid = new UpdatePlantLogForPlantCommand
            {
                Id             = logPlant1.Id,
                PlantId        = plant1.Id,
                PlantLogTypeId = logType.Id,
                DateTime       = DateTime.Now,
                Log            = LoremIpsum.Words(2)
            };

            validator.ShouldNotHaveValidationErrorFor(updatePlantLogForPlantCommand => updatePlantLogForPlantCommand.Id, updateValid);
            validator.ShouldNotHaveValidationErrorFor(updatePlantLogForPlantCommand => updatePlantLogForPlantCommand.PlantId, updateValid);
            validator.ShouldNotHaveValidationErrorFor(updatePlantLogForPlantCommand => updatePlantLogForPlantCommand.PlantLogTypeId, updateValid);
            validator.ShouldNotHaveValidationErrorFor(updatePlantLogForPlantCommand => updatePlantLogForPlantCommand.DateTime, updateValid);
            validator.ShouldNotHaveValidationErrorFor(updatePlantLogForPlantCommand => updatePlantLogForPlantCommand.Log, updateValid);

            // wrong plant id
            var updateInvalidPlantId = new UpdatePlantLogForPlantCommand
            {
                Id             = logPlant1.Id,
                PlantId        = plant2.Id,
                PlantLogTypeId = logType.Id,
                DateTime       = DateTime.Now,
                Log            = LoremIpsum.Words(2)
            };

            validator.ShouldNotHaveValidationErrorFor(updatePlantLogForPlantCommand => updatePlantLogForPlantCommand.Id, updateInvalidPlantId);
            validator.ShouldHaveValidationErrorFor(updatePlantLogForPlantCommand => updatePlantLogForPlantCommand.PlantId, updateInvalidPlantId);
            validator.ShouldNotHaveValidationErrorFor(updatePlantLogForPlantCommand => updatePlantLogForPlantCommand.PlantLogTypeId, updateInvalidPlantId);
            validator.ShouldNotHaveValidationErrorFor(updatePlantLogForPlantCommand => updatePlantLogForPlantCommand.DateTime, updateInvalidPlantId);
            validator.ShouldNotHaveValidationErrorFor(updatePlantLogForPlantCommand => updatePlantLogForPlantCommand.Log, updateInvalidPlantId);

            // wrong log type id
            var updateInvalidLogType = new UpdatePlantLogForPlantCommand
            {
                Id             = logPlant1.Id,
                PlantId        = plant1.Id,
                PlantLogTypeId = Guid.NewGuid(),
                DateTime       = DateTime.Now,
                Log            = LoremIpsum.Words(2)
            };

            validator.ShouldNotHaveValidationErrorFor(updatePlantLogForPlantCommand => updatePlantLogForPlantCommand.Id, updateInvalidLogType);
            validator.ShouldNotHaveValidationErrorFor(updatePlantLogForPlantCommand => updatePlantLogForPlantCommand.PlantId, updateInvalidLogType);
            validator.ShouldHaveValidationErrorFor(updatePlantLogForPlantCommand => updatePlantLogForPlantCommand.PlantLogTypeId, updateInvalidLogType);
            validator.ShouldNotHaveValidationErrorFor(updatePlantLogForPlantCommand => updatePlantLogForPlantCommand.DateTime, updateInvalidLogType);
            validator.ShouldNotHaveValidationErrorFor(updatePlantLogForPlantCommand => updatePlantLogForPlantCommand.Log, updateInvalidLogType);
        }
Ejemplo n.º 11
0
        public async Task TestCreateValidator()
        {
            await using var context = DatabaseHelper.CreateInMemoryDatabaseContext(nameof(TestCreateValidator));
            // setup
            var logType      = ValidObjectHelper.ValidPlantLogType();
            var plantSpecies = ValidObjectHelper.ValidPlantSpecies();
            var plant        = ValidObjectHelper.ValidPlant(plantSpecies);
            await context.AddRangeAsync(logType, plantSpecies, plant);

            await context.SaveChangesAsync();


            var validator      = new CreatePlantLogForPlantCommandValidator(context);
            var createValidCmd = new CreatePlantLogForPlantCommand
            {
                Id             = Guid.NewGuid(),
                PlantId        = plant.Id,
                PlantLogTypeId = logType.Id,
                DateTime       = DateTime.Now,
                Log            = LoremIpsum.Words(2),
            };

            validator.ShouldNotHaveValidationErrorFor(plantLogCmd => plantLogCmd.Id, createValidCmd);
            validator.ShouldNotHaveValidationErrorFor(plantLogCmd => plantLogCmd.PlantId, createValidCmd);
            validator.ShouldNotHaveValidationErrorFor(plantLogCmd => plantLogCmd.PlantLogTypeId, createValidCmd);
            validator.ShouldNotHaveValidationErrorFor(plantLogCmd => plantLogCmd.DateTime, createValidCmd);
            validator.ShouldNotHaveValidationErrorFor(plantLogCmd => plantLogCmd.Log, createValidCmd);

            //invalid plant log type
            var createInvalidLogTypeCmd = new CreatePlantLogForPlantCommand
            {
                Id             = Guid.NewGuid(),
                PlantId        = plant.Id,
                PlantLogTypeId = Guid.NewGuid(),
                DateTime       = DateTime.Now,
                Log            = LoremIpsum.Words(2),
            };

            validator.ShouldNotHaveValidationErrorFor(plantLogCmd => plantLogCmd.Id, createInvalidLogTypeCmd);
            validator.ShouldNotHaveValidationErrorFor(plantLogCmd => plantLogCmd.PlantId, createInvalidLogTypeCmd);
            validator.ShouldHaveValidationErrorFor(plantLogCmd => plantLogCmd.PlantLogTypeId, createInvalidLogTypeCmd);
            validator.ShouldNotHaveValidationErrorFor(plantLogCmd => plantLogCmd.DateTime, createInvalidLogTypeCmd);
            validator.ShouldNotHaveValidationErrorFor(plantLogCmd => plantLogCmd.Log, createInvalidLogTypeCmd);

            //invalid plant log type
            var createInvalidPlantCmd = new CreatePlantLogForPlantCommand
            {
                Id             = Guid.NewGuid(),
                PlantId        = Guid.NewGuid(),
                PlantLogTypeId = logType.Id,
                DateTime       = DateTime.Now,
                Log            = LoremIpsum.Words(2),
            };

            validator.ShouldNotHaveValidationErrorFor(plantLogCmd => plantLogCmd.Id, createInvalidPlantCmd);
            validator.ShouldHaveValidationErrorFor(plantLogCmd => plantLogCmd.PlantId, createInvalidPlantCmd);
            validator.ShouldNotHaveValidationErrorFor(plantLogCmd => plantLogCmd.PlantLogTypeId, createInvalidPlantCmd);
            validator.ShouldNotHaveValidationErrorFor(plantLogCmd => plantLogCmd.DateTime, createInvalidPlantCmd);
            validator.ShouldNotHaveValidationErrorFor(plantLogCmd => plantLogCmd.Log, createInvalidPlantCmd);

            //invalid id
            var createInvalidIdCmd = new CreatePlantLogForPlantCommand
            {
                Id             = Guid.Empty,
                PlantId        = plant.Id,
                PlantLogTypeId = logType.Id,
                DateTime       = DateTime.Now,
                Log            = LoremIpsum.Words(2),
            };

            validator.ShouldHaveValidationErrorFor(plantLogCmd => plantLogCmd.Id, createInvalidIdCmd);
            validator.ShouldNotHaveValidationErrorFor(plantLogCmd => plantLogCmd.PlantId, createInvalidIdCmd);
            validator.ShouldNotHaveValidationErrorFor(plantLogCmd => plantLogCmd.PlantLogTypeId, createInvalidIdCmd);
            validator.ShouldNotHaveValidationErrorFor(plantLogCmd => plantLogCmd.DateTime, createInvalidIdCmd);
            validator.ShouldNotHaveValidationErrorFor(plantLogCmd => plantLogCmd.Log, createInvalidIdCmd);
        }
Ejemplo n.º 12
0
        public async Task QueryAllPlants()
        {
            await using var context = DatabaseHelper.CreateInMemoryDatabaseContext(nameof(QueryAllPlants));
            var plantSpecies1 = ValidObjectHelper.ValidPlantSpecies();
            var plantSpecies2 = ValidObjectHelper.ValidPlantSpecies();
            await context.PlantSpecies.AddRangeAsync(plantSpecies1, plantSpecies2);

            var id1 = Guid.NewGuid();
            var id2 = Guid.NewGuid();
            var id3 = Guid.NewGuid();
            var id4 = Guid.NewGuid();
            var id5 = Guid.NewGuid();

            var name1 = "Hello";
            var name2 = "World";
            var name3 = "ab";
            var name4 = "world Hello abcdefgh";
            var name5 = "Töster";

            var plant1 = new Plant
            {
                Id = id1, Name = name1, PlantSpeciesId = plantSpecies1.Id, PlantState = PlantState.Active
            };
            var plant2 = new Plant
            {
                Id = id2, Name = name2, PlantSpeciesId = plantSpecies2.Id, PlantState = PlantState.Active
            };
            var plant3 = new Plant
            {
                Id = id3, Name = name3, PlantSpeciesId = plantSpecies1.Id, PlantState = PlantState.Active
            };
            var plant4 = new Plant
            {
                Id = id4, Name = name4, PlantSpeciesId = plantSpecies2.Id, PlantState = PlantState.Active
            };
            var plant5 = new Plant
            {
                Id = id5, Name = name5, PlantSpeciesId = plantSpecies1.Id, PlantState = PlantState.Active
            };

            await context.Plants.AddRangeAsync(plant1, plant2, plant3, plant4, plant5);

            await context.SaveChangesAsync();


            var queryAll     = new GetAllPlantsQuery();
            var queryHandler = new GetAllPlantsQueryHandler(context);
            var result       = await queryHandler.Handle(queryAll, CancellationToken.None);

            Assert.True(result.Success);
            Assert.Equal(5, result.Data.Count());
            Assert.Contains(result.Data,
                            dto => dto.Id.Equals(id1) && dto.Name.Equals(name1) && dto.PlantSpeciesId.Equals(plantSpecies1.Id) &&
                            dto.IsActive);
            Assert.Contains(result.Data,
                            dto => dto.Id.Equals(id2) && dto.Name.Equals(name2) && dto.PlantSpeciesId.Equals(plantSpecies2.Id) &&
                            dto.IsActive);
            Assert.Contains(result.Data,
                            dto => dto.Id.Equals(id3) && dto.Name.Equals(name3) && dto.PlantSpeciesId.Equals(plantSpecies1.Id) &&
                            dto.IsActive);
            Assert.Contains(result.Data,
                            dto => dto.Id.Equals(id4) && dto.Name.Equals(name4) && dto.PlantSpeciesId.Equals(plantSpecies2.Id) &&
                            dto.IsActive);
            Assert.Contains(result.Data,
                            dto => dto.Id.Equals(id5) && dto.Name.Equals(name5) && dto.PlantSpeciesId.Equals(plantSpecies1.Id) &&
                            dto.IsActive);
        }