コード例 #1
0
        public void Can_Add_Multiple_Telephone_Numbers()
        {
            // Arrange
            PhysicalPerson person = new PhysicalPerson("12345678901", "Mile", "Milic");
            Telephone telephone1 = new Telephone("Kucni telefon", "123456");
            Telephone telephone2 = new Telephone("Mobitel", "098123456");

            // Act
            person.AddTelephone(telephone1);
            person.AddTelephone(telephone2);

            // Assert
            Assert.AreEqual(2, person.Telephones.Count, "Trebala bi postojati dva telefonska broja.");
            Assert.AreEqual("123456", person.Telephones[0].TelephoneNumber, "Prvi broj telefona nije isti kao zadani.");
            Assert.AreEqual("098123456", person.Telephones[1].TelephoneNumber, "Drugi broj telefona nije isti kao zadani.");
        }
コード例 #2
0
        public void Can_Remove_Existing_Telehone_Number()
        {
            // Arange
            PhysicalPerson person = new PhysicalPerson("12345678901", "Mile", "Milic");
            Telephone telephone1 = new Telephone("Kucni telefon", "123456");
            Telephone telephone2 = new Telephone("Mobitel", "098123456");

            person.AddTelephone(telephone1);
            person.AddTelephone(telephone2);

            // Act
            var isSuccess = person.RemoveTelephone(telephone1);

            // Assert
            Assert.IsTrue(isSuccess);
            Assert.AreEqual(1, person.Telephones.Count, "Trebao bi postojati jedan telefonski broj.");
            Assert.AreEqual("098123456", person.Telephones[0].TelephoneNumber, "To nije broj mobitela, odnosno drugi zadani broj telefona..");
        }
コード例 #3
0
        public void Can_Take_Snapshot_Of_Person()
        {
            // Arrange
            PhysicalPerson person = new PhysicalPerson("12345678901", "Mile", "Milic");
            Telephone telephone1 = new Telephone("Kucni telefon", "123456");
            Telephone telephone2 = new Telephone("Mobitel", "098123456");

            person.AddTelephone(telephone1);
            person.AddTelephone(telephone2);

            // Act
            var personSnapshot = new PersonSnapshot(person);

            // Assert
            Assert.AreEqual(person.Oib, personSnapshot.Oib);
            Assert.AreEqual(person.FullName, personSnapshot.FullName);
            Assert.AreEqual(person.Address, personSnapshot.Address);
            Assert.AreEqual(person.Telephones, personSnapshot.Telephones);
        }