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 Delete_LastStar_ShouldReturnFalse() { // Arrange StarStuffDbContext db = this.Database; StarService starService = new StarService(db); this.SeedDiscovery(db, 1); // Act bool result = starService.Delete(1); // Assert Assert.False(result); }
public void Total_WithNotExistingPublicationId_ShouldReturnZero() { // Arrange StarStuffDbContext db = this.Database; CommentService commentService = new CommentService(db); int expected = 0; // Act int actual = commentService.Total(1); // Assert Assert.Equal(expected, actual); }
public void Delete_WithExistingId_ShouldReturnTrue() { // Arrange StarStuffDbContext db = this.Database; PlanetService planetService = new PlanetService(db); this.SeedDatabase(db); // Act bool result = planetService.Delete(1); // Assert Assert.True(result); }
public void GetForm_WithNotExistingId_ShouldReturnNull() { // Arrange StarStuffDbContext db = this.Database; JournalService journalService = new JournalService(db); const int journalId = 1; // Act JournalFormServiceModel actual = journalService.GetForm(journalId); // Assert Assert.Null(actual); }
public void TitleExists_WithNotExistingPublicationTitle_ShouldReturnFalse() { // Arrange StarStuffDbContext db = this.Database; PublicationService publicationService = new PublicationService(db); string title = this.GetFakePublications().First().Title; // Act bool result = publicationService.TitleExists(title); // Assert Assert.False(result); }
public void Exists_WithNotExistingName_ShouldReturnFalse() { // Arrange StarStuffDbContext db = this.Database; TelescopeService telescopeService = new TelescopeService(db); string telescopeName = this.GetFakeTelescopes().FirstOrDefault(t => t.Id == 1).Name; // Act bool result = telescopeService.Exists(telescopeName); // Assert Assert.False(result); }
public void Stars_WithNotExistingDiscoveryId_ShouldReturnEmptyCollection() { // Arrange StarStuffDbContext db = this.Database; StarService starService = new StarService(db); const int discoveryId = 1; // Act IEnumerable <ListStarsServiceModel> stars = starService.Stars(discoveryId); // Assert Assert.False(stars.Any()); }
public void Create_WithExistingPublicationIdAndNotExistingUserId_ShouldReturnFalse() { // Arrange StarStuffDbContext db = this.Database; CommentService commentService = new CommentService(db); this.SeedPublication(db); // Act bool result = commentService.Create(1, 1, "Test Content"); // Assert Assert.False(result); }
public void GetForm_WithExistingCommentId_ShouldReturnNull() { // Arrange StarStuffDbContext db = this.Database; CommentService commentService = new CommentService(db); const int commentId = 1; // Act CommentFormServiceModel result = commentService.GetForm(commentId); // Assert Assert.Null(result); }
public void Edit_WithNotExistingId_ShouldReturnFalse() { // Arrange StarStuffDbContext db = this.Database; PlanetService planetService = new PlanetService(db); this.SeedDatabase(db); // Act bool result = planetService.Edit(11, "Not Existing 1", 20.5); // Assert Assert.False(result); }
public void Delete_WithExistingCommentId_ShouldReturnTrue() { // Arrange StarStuffDbContext db = this.Database; CommentService commentService = new CommentService(db); this.SeedCommanets(db); // Act bool result = commentService.Delete(1); // Assert Assert.True(result); }
public void GetForm_WithNotExistingId_ShouldReturnNull() { // Arrange StarStuffDbContext db = this.Database; PublicationService publicationService = new PublicationService(db); const int publicationId = 1; // Act PublicationFormServiceModel result = publicationService.GetForm(publicationId); // Assert Assert.Null(result); }
public void Exists_WithNotExistingName_ShouldReturnFalse() { // Arrange StarStuffDbContext db = this.Database; StarService starService = new StarService(db); string name = this.GetFakeStars().First().Name; // Act bool result = starService.Exists(name); // Assert Assert.False(result); }
public void Planets_WithNotExistingDiscoveryId_ShouldReturnEmptyCollection() { // Arrange StarStuffDbContext db = this.Database; PlanetService planetService = new PlanetService(db); this.SeedDiscovery(db, false, true); // Act IEnumerable <ListPlanetsServiceModel> planets = planetService.Planets(2); // Assert Assert.False(planets.Any()); }
public void GetForm_WithNotExistingId_ShouldReturnNull() { // Arrange StarStuffDbContext db = this.Database; PlanetService planetService = new PlanetService(db); this.SeedDatabase(db); // Act PlanetFormServiceModel actual = planetService.GetForm(11); // Assert Assert.Null(actual); }
public void Total_ShouldReturnValidTelescopeCount() { // Arrange StarStuffDbContext db = this.Database; TelescopeService telescopeService = new TelescopeService(db); this.SeedDatabase(db); int expected = db.Telescopes.Count(); // Act int actual = telescopeService.Total(); // Assert Assert.Equal(expected, actual); }
public void Exists_WithExistingName_ShouldReturnTrue() { // Arrange StarStuffDbContext db = this.Database; JournalService journalService = new JournalService(db); this.SeedDatabase(db); // Act string name = this.GetFakeJournals().FirstOrDefault(j => j.Id == 1).Name; bool result = journalService.Exists(name); // Assert Assert.True(result); }
public void GetForm_WithExistingId_ShouldReturnCorrectResult() { // Arrange StarStuffDbContext db = this.Database; PlanetService planetService = new PlanetService(db); this.SeedDatabase(db); Planet expected = this.GetFakePlanets().First(); // Act PlanetFormServiceModel actual = planetService.GetForm(expected.Id); // Assert this.ComparePlanets(expected, actual); }
public void GetName_WithExistingId_ShouldReturnValidName() { // Arrange StarStuffDbContext db = this.Database; PlanetService planetService = new PlanetService(db); this.SeedDatabase(db); // Act Planet planet = this.GetFakePlanets().First(); string actual = planetService.GetName(planet.Id); // Assert Assert.Equal(planet.Name, actual); }
public void Exists_WithExistingName_ShouldReturnTrue() { // Arrange StarStuffDbContext db = this.Database; PlanetService planetService = new PlanetService(db); this.SeedDatabase(db); // Act string name = this.GetFakePlanets().First().Name; bool result = planetService.Exists(name); // Assert Assert.True(result); }
public void Delete_WithNotExistingId_ShouldReturnFalse() { // Arrange StarStuffDbContext db = this.Database; StarService starService = new StarService(db); int starsCount = this.GetFakeStars().Count; this.SeedDiscovery(db, starsCount); // Act bool result = starService.Delete(starsCount + 1); // Assert Assert.False(result); }
public void GetName_WithExistingId_ShouldReturnValidName() { // Arrange StarStuffDbContext db = this.Database; StarService starService = new StarService(db); this.SeedDatabase(db); Star star = this.GetFakeStars().First(); // Act string actual = starService.GetName(star.Id); // Assert Assert.Equal(star.Name, actual); }
public void Delete_WithNotExistingId_ShouldNotRemoveStar() { // Arrange StarStuffDbContext db = this.Database; StarService starService = new StarService(db); int starsCount = this.GetFakeStars().Count; this.SeedDiscovery(db, starsCount); // Act starService.Delete(11); // Assert Assert.Equal(starsCount, db.Stars.Count()); }
public void Delete_WithExistingCommentId_ShouldDeleteComment() { // Arrange StarStuffDbContext db = this.Database; CommentService commentService = new CommentService(db); this.SeedCommanets(db); const int commentId = 1; // Act commentService.Delete(commentId); // Assert Assert.False(db.Comments.Any(c => c.Id == commentId)); }
public void Create_WithNotExistingDeiscovery_ShouldReturnFalse() { // Arrange StarStuffDbContext db = this.Database; StarService starService = new StarService(db); const int discoveryId = 1; Star expected = this.GetFakeStars().First(); // Act bool result = starService.Create(discoveryId, expected.Name, expected.Temperature); // Assert Assert.False(result); }
public void Total_WithExistingPublicationId_ShouldReturnCommentsCount() { // Arrange StarStuffDbContext db = this.Database; CommentService commentService = new CommentService(db); this.SeedCommanets(db); int expected = this.GetFakeComments().Count; // Act int actual = commentService.Total(1); // Assert Assert.Equal(expected, actual); }
public void GetTitle_WithExistingPublicationId_ShouldReturnPublicationTitle() { // Arrange StarStuffDbContext db = this.Database; PublicationService publicationService = new PublicationService(db); this.SeedDatabase(db); string expected = this.GetFakePublications().First().Title; // Act string actual = publicationService.GetTitle(1); // Assert Assert.Equal(expected, actual); }
public void Edit_WithNotExistingId_ShouldReturnFalse() { // Arrange StarStuffDbContext db = this.Database; PublicationService publicationService = new PublicationService(db); const int publicationId = 1; Publication publication = this.GetFakePublications().First(); // Act bool result = publicationService.Edit(publicationId, publication.Title, publication.Content); // Assert Assert.False(result); }
public void Total_ShouldReturnPublicationsCount() { // Arrange StarStuffDbContext db = this.Database; PublicationService publicationService = new PublicationService(db); this.SeedDatabase(db); int expected = this.GetFakePublications().Count; // Act int actual = publicationService.Total(); // Assert Assert.Equal(expected, actual); }