Beispiel #1
0
        public void WebsiteRepository_GetLargestId()
        {
            //Arrange
            Database.Add(new Websites()
            {
                Id = 25, Hostname = "fcc.gov"
            });
            Database.Add(new Websites()
            {
                Id = 50, Hostname = "usa.gov"
            });
            Database.Add(new Websites()
            {
                Id = 75, Hostname = "epa.gov"
            });
            Database.SaveChanges();

            var repository = new WebsiteRepository(new DatabaseFactory(Database));

            //Act
            var maxId = repository.GetLargestId();

            //Assert
            Assert.AreEqual(75, maxId);
        }
Beispiel #2
0
        public void WebsiteRepository_GetLargestId_NoWebsites()
        {
            //Arrange
            var repository = new WebsiteRepository(new DatabaseFactory(Database));

            //Act
            var maxId = repository.GetLargestId();

            //Assert
            Assert.AreEqual(0, maxId);
        }