public void Reset_to_zero()
        {
            //Arrange
            int personId = 15;

            //Act
            PersonSequencer.Reset();
            personId = PersonSequencer.NextPersonId();

            //Assert
            Assert.Equal(1, personId);
        }
예제 #2
0
        public void IncresId()
        {
            //Arrange
            int number   = PersonSequencer.NextPersonId();// Onely works cuz its static
            int expected = number + 1;

            //Act
            int result = PersonSequencer.NextPersonId();

            //Assert
            Assert.Equal(expected, result);
        }
예제 #3
0
        public void PersonIdCountsUp()
        {
            //arrange
            int previousValue = PersonSequencer.NextPersonId();
            int expected      = previousValue + 1;

            //act
            int result = PersonSequencer.NextPersonId();

            //assert
            Assert.Equal(expected, result);
        }
예제 #4
0
        [Fact] //Test if increases by 1
        public void TestIncreaseIdSequence()
        {
            //Arrange
            int expected = 1; // first person starts at 1;

            //Act
            PersonSequencer.Reset();
            int actual = PersonSequencer.NextPersonId();

            //Assert
            Assert.Equal(expected, actual);
        }
예제 #5
0
        [Fact] //Test if it resets to 0

        public void TestResetSequence()
        {
            //Arrange
            PersonSequencer.NextPersonId();
            int personIdReset = 1;

            //Act

            PersonSequencer.Reset();
            int resetId = PersonSequencer.NextPersonId();

            //Assert
            Assert.Equal(personIdReset, resetId);
        }
예제 #6
0
        public void RunReset()
        {
            //Run reset before act to remove possible static values
            PersonSequencer.Reset();

            //Arrange & //Act
            int firstId = PersonSequencer.NextPersonId();

            PersonSequencer.Reset();
            int secondId = PersonSequencer.NextPersonId();

            //Assert

            Assert.Equal(1, secondId);
        }
예제 #7
0
        public void RunNextPersonId()
        {
            PersonSequencer.Reset();
            //Arrange
            int firstId  = 1;
            int secondId = 2;


            //Act
            int firstResult  = PersonSequencer.NextPersonId();
            int secondResult = PersonSequencer.NextPersonId();

            //Assert

            Assert.Equal(firstId, firstResult);
            Assert.Equal(secondId, secondResult);
            PersonSequencer.Reset();
        }
예제 #8
0
        public void ResetToZero()
        {
            //arrange
            int expected = 1;

            // To be sure there tested numbers stored in personId variabal
            for (int i = 0; i < 10; i++)
            {
                PersonSequencer.NextPersonId();
            }
            //act
            PersonSequencer.Reset();

            int result = PersonSequencer.NextPersonId();

            //Assert to be sure the reset acts to reset the personId
            Assert.Equal(expected, result);
        }
예제 #9
0
        public void PersonIdCountUpResets()
        {
            //Arrange

            int expected = 1;

            for (int i = 0; i < 10; i++)
            {
                PersonSequencer.NextPersonId();
            }

            //Act
            PersonSequencer.Reset();
            int result = PersonSequencer.NextPersonId();

            //Assert
            Assert.Equal(expected, result);
        }
예제 #10
0
 public Person(string firstname, string lastname) //Constructor
 {
     PersonId  = PersonSequencer.NextPersonId();  //Uses PersonSequencer to get next id.
     FirstName = firstname;
     LastName  = lastname;
 }