Ejemplo n.º 1
0
        public void Exists_WithNotExistingJournalAndDiscovery_ShouldReturnFalse()
        {
            // Arrange
            StarStuffDbContext db = this.Database;
            PublicationService publicationService = new PublicationService(db);

            this.SeedDatabase(db);

            const int discoveryId = 1;
            const int journalId   = 1;

            // Act
            bool result = publicationService.Exists(journalId, discoveryId);

            // Assert
            Assert.False(result);
        }
Ejemplo n.º 2
0
        public void Exists_WithExistingJournalAndDiscovery_ShouldReturnTrue()
        {
            // Arrange
            StarStuffDbContext db = this.Database;
            PublicationService publicationService = new PublicationService(db);

            this.SeedDatabase(db);

            const int discoveryId = 1;
            const int journalId   = 1;

            Publication publication = db.Publications.Find(1);

            publication.DiscoveryId = discoveryId;
            publication.JournalId   = journalId;
            db.SaveChanges();

            // Act
            bool result = publicationService.Exists(journalId, discoveryId);

            // Assert
            Assert.True(result);
        }