GardenPlanner/test/entities/plant_test.dart

40 lines
1.4 KiB
Dart

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