GardenPlanner/test/entities/plant_in_row_test.dart

44 lines
1.6 KiB
Dart

import 'package:flutter_test/flutter_test.dart';
import 'package:garden_planner/entities/plant.dart';
import 'package:garden_planner/entities/plant_in_row.dart';
void main() {
test('PlantInRow entity Test', () {
// Arrange
const int plantId = 1;
const String name = 'Plant 1';
const double waterRequirement = 2;
const String description = "test Descriptiom";
const double horizontalSpace = 3;
const double verticalSpace = 4;
const String image = "test image";
final plant = Plant(
name: name,
id: plantId,
waterRequirement: waterRequirement,
supType: description,
horizontalSpace: horizontalSpace,
verticalSpace: verticalSpace);
plant.image = image;
// Act
final plantInRow = PlantInRow(position: 0, plant: plant);
// Assert
expect(plantInRow.position, equals(0), reason: 'position should be 0');
expect(plantInRow.id, equals(plantId), reason: 'id should be $plantId');
expect(plantInRow.name, equals(name), reason: 'name should be $name');
expect(plantInRow.supType, equals(description),
reason: 'SupType should be $description');
expect(plantInRow.verticalSpace, equals(verticalSpace),
reason: 'Verical Space should be $verticalSpace');
expect(plantInRow.horizontalSpace, equals(horizontalSpace),
reason: 'Horizontal Space should be $horizontalSpace');
expect(plantInRow.waterRequirement, equals(waterRequirement),
reason: 'Water requirement should be $waterRequirement');
expect(plantInRow.image, equals(image), reason: 'image should be $image');
});
}