Beispiel #1
0
        public void AddAddress_AddressAdded_True()
        {
            Address address = new Address("testAddress");

            _citizen.AddAddress(address);

            Assert.AreEqual(address, _citizen.GetAddress(new DateTime()));
        }
Beispiel #2
0
        public void GetTasks_CorrectDate_ReturnsExpectedAddress()
        {
            //Arrange
            Address address = new Address("testAddress")
            {
                StartDate = new DateTime(2015, 12, 31)
            };

            Citizen c = new Citizen("1234567890", "bo", "bosen", address, new DateTime(2012, 1, 1));

            for (int i = 1; i < 10; i += 2)
            {
                DateTime d = new DateTime(2016, 1, i);
                Address  a = new Address("testAddress")
                {
                    StartDate = d
                };
                c.AddAddress(a);
            }

            //Act
            Address actualAddress = c.GetAddress(new DateTime(2016, 1, 4));

            Address expectedAdress = new Address("testAddress")
            {
                StartDate = new DateTime(2016, 1, 3)
            };

            //assert
            Assert.AreEqual(expectedAdress, actualAddress);
        }
Beispiel #3
0
        /// <summary>
        /// Changes the address of a citizen.
        /// </summary>
        /// <param name="citizen">Citizen that has changed address.</param>
        /// <param name="addressString">The new address.</param>
        /// <param name="fromDate">The date address is valid from.</param>
        public void ChangeCitizenAddress(Citizen citizen, string addressString, DateTime fromDate)
        {
            Address newAddress = CreateAddress(addressString, fromDate);

            citizen.AddAddress(newAddress);
        }