コード例 #1
0
        public void ProcessData_validID_callsReportPrinter()
        {
            PersonRepositoryStub_OK repository = new PersonRepositoryStub_OK();
            string   oib         = "12345678912";
            string   name        = "Ana";
            string   surname     = "Anic";
            DateTime dateOfBirth = new DateTime(1988, 6, 6);
            string   adress      = "Ilica 6";
            string   eMail       = "*****@*****.**";

            repository.Person = new Person(oib, name, surname, dateOfBirth, adress, eMail);
            ReportPrinterMock printer   = new ReportPrinterMock();
            DataProcessor     processor = new DataProcessor();

            processor.Repository = repository;
            processor.Printer    = printer;
            processor.ProcessData(oib);

            Assert.AreEqual(oib, printer.Oib);
            Assert.AreEqual(name, printer.Name);
            Assert.AreEqual(surname, printer.Surname);
            Assert.AreEqual(dateOfBirth, printer.DateOfBirth);
            Assert.AreEqual(adress, printer.Adress);
            Assert.AreEqual(eMail, printer.EMail);
        }
コード例 #2
0
        public void ProcessData_invalidID_throwsException()
        {
            PersonRepositoryStub_Exception repository = new PersonRepositoryStub_Exception();

            repository.ToThrow = new PersonDoesNotExistException();
            IReportPrinter printer   = new ReportPrinterMock();
            DataProcessor  processor = new DataProcessor();

            processor.Repository = repository;
            processor.Printer    = printer;
            processor.ProcessData("12345678913");
        }