public void Create_WithNotExistingDicovery_ShouldReturnFalse() { // Arrange StarStuffDbContext db = this.Database; PlanetService planetService = new PlanetService(db); Planet planet = this.GetFakePlanets().First(); // Act bool result = planetService.Create(1, planet.Name, planet.Mass); // Assert Assert.False(result); }
public void Create_WithNotExistingName_ShouldReturnTrue() { // Arrange StarStuffDbContext db = this.Database; PlanetService planetService = new PlanetService(db); const int discoveryId = 1; this.SeedDiscovery(db, true); Planet expected = this.GetFakePlanets().First(); // Act bool result = planetService.Create(discoveryId, expected.Name, expected.Mass); // Assert Assert.True(result); }
public void Create_WithNotExistingName_ShouldAddPlanet() { // Arrange StarStuffDbContext db = this.Database; PlanetService planetService = new PlanetService(db); const int discoveryId = 1; this.SeedDiscovery(db, true); Planet expected = this.GetFakePlanets().First(); // Act planetService.Create(discoveryId, expected.Name, expected.Mass); Planet actual = db.Planets.First(); // Assert Assert.Equal(1, db.Planets.Count()); this.ComparePlanets(expected, actual); }