public void Delete_NonexistentTeam_PreservesNumberOfRecords()
        {
            // Arrange
            var numPreExistingTeams = AdapterTestHelpers.CountSqlTeams(ConnectionString);

            // Act
            Adapter.Delete(Guid.NewGuid());

            // Assert
            var numPostExistingTeams = AdapterTestHelpers.CountSqlTeams(ConnectionString);

            Assert.AreEqual(numPreExistingTeams, numPostExistingTeams);
        }
        public void Save_NewTeam_InsertsOneRecord()
        {
            // Arrange
            var numPreExistingTeams = AdapterTestHelpers.CountSqlTeams(ConnectionString);
            var newTeam             = new Team(Guid.NewGuid(), "Guardians of the Galaxy", new List <Hero>());

            // Act
            Adapter.Save(newTeam);

            // Assert
            var numPostExistingTeams = AdapterTestHelpers.CountSqlTeams(ConnectionString);

            Assert.AreEqual(numPreExistingTeams + 1, numPostExistingTeams);
        }
        public void Delete_ExistingTeam_RemovesOneRecord()
        {
            // Arrange

            // make sure at least one team exists, so we can delete it
            var team = new Team(Guid.NewGuid(), "Bat-Family", new List <Hero>());

            Adapter.Save(team);
            var numPreExistingTeams = AdapterTestHelpers.CountSqlTeams(ConnectionString);

            // Act
            Adapter.Delete(team.Id);

            // Assert
            var numPostExistingPowers = AdapterTestHelpers.CountSqlTeams(ConnectionString);

            Assert.AreEqual(numPreExistingTeams - 1, numPostExistingPowers);
        }
        public void Save_ExistingTeam_PreservesNumberOfRecords()
        {
            // Arrange

            // make sure at least one power exists, so we have something to update
            var oldTeam = new Team(Guid.NewGuid(), "Justice League", new List <Hero>());

            Adapter.Save(oldTeam);
            var numPreExistingTeams = AdapterTestHelpers.CountSqlTeams(ConnectionString);

            // Act
            var newTeam = new Team(oldTeam.Id, "SUPER JUSTICE LEAGUE!!!!11", new List <Hero>());

            Adapter.Save(newTeam);

            // Assert
            var numPostExistingTeams = AdapterTestHelpers.CountSqlTeams(ConnectionString);

            Assert.AreEqual(numPreExistingTeams, numPostExistingTeams);
        }