public void Create_WithNotExistingName_ShouldReturnCorrectTelescopeId() { // Arrange StarStuffDbContext db = this.Database; TelescopeService telescopeService = new TelescopeService(db); const int telescopeId = 1; Telescope telescope = this.GetFakeTelescopes().FirstOrDefault(t => t.Id == telescopeId); // Act int result = telescopeService.Create( telescope.Name, telescope.Location, telescope.Description, telescope.MirrorDiameter, telescope.ImageUrl); // Assert Assert.Equal(telescopeId, result); }
public void Create_WithNotExistingName_ShouldAddTelescope() { // Arrange StarStuffDbContext db = this.Database; TelescopeService telescopeService = new TelescopeService(db); const int telescopeId = 1; Telescope expected = this.GetFakeTelescopes().FirstOrDefault(t => t.Id == telescopeId); // Act telescopeService.Create( expected.Name, expected.Location, expected.Description, expected.MirrorDiameter, expected.ImageUrl); Telescope actual = db.Telescopes.Find(telescopeId); // Assert this.CompareTelescopes(expected, actual); }