public void PersonFrom_Must_Have_Valid_Bank_Account_Number() { // Arrange Person person = new PhysicalPerson("12345678901", "Mile", "Milic"); LegalPerson legalPerson = new LegalPerson("12345678901", "Mile d.o.o"); // Act Bill bill = new Bill(person, legalPerson, 23); // Assert }
public void Can_Create_Bill() { // Arrange Person person = new PhysicalPerson("12345678901", "Mile", "Milic"); LegalPerson legalPerson = new LegalPerson("12345678901", "Mile d.o.o") { NumberOfBankAccount = "123487815645" }; // Act Bill bill = new Bill(person, legalPerson, 23); // Assert Assert.IsNotNull(bill); Assert.IsFalse(bill.IsPayed); }
public void LandRegistry_With_PartitionSpaces_Has_Total_SurfaceAres() { // Arrange landRegistry.CreatePartitionSpace(23.52m, "Stan 1"); var owner = new PhysicalPerson("12345678901", "Mile", "Milic"); landRegistry.CreatePartitionSpace(35.1m, "Stan 2", owner, 125); // Act var result = landRegistry.TotalSurfaceOfPartitionSpaces; // Assert Assert.AreEqual(58.62, result); }
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."); }
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.."); }
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); }
public void Can_Calculate_Correct_Total_Amount_With_And_Without_Tax() { // Arrange Person person = new PhysicalPerson("12345678901", "Mile", "Milic"); LegalPerson legalPerson = new LegalPerson("12345678901", "Mile d.o.o") { NumberOfBankAccount = "123487815645" }; Bill bill = new Bill(person, legalPerson, 23); bill.AddBillItem(new BillItem(1, 23.5m, "Kruške")); bill.AddBillItem(new BillItem(3, 46.8m, "Jabuke")); // Act var totalAmount = bill.TotalAmount; var totalAmountWithTax = bill.TotalAmountWithTax; // Assert Assert.AreEqual(163.9m, totalAmount); Assert.AreEqual(201.597m, totalAmountWithTax); }
public void If_Oib_Is_Invalid_Should_Throw_RuleException() { var person1 = new PhysicalPerson("123456", "Mile", "Milic"); var person2 = new PhysicalPerson("abs", "Mile", "Milic"); }
private static Person getPerson() { // Dohvacanje osobe iz repozitorija Person personForMock = new PhysicalPerson("12345678901", "Mile", "Milic"); Mock<IPersonsRepository> personRepositoryMock = new Mock<IPersonsRepository>(); personRepositoryMock.Setup(x => x.GetByOib("12345678901")).Returns(personForMock); return personRepositoryMock.Object.GetByOib("12345678901"); }