Example #1
0
 public Contact(ContactBuilder builder)
 {
     Name            = builder.Name;
     TelephoneNumber = builder.TelephoneNumber;
     EmailAddress    = builder.EmailAddress;
     Providers       = builder.Providers;
 }
Example #2
0
        public void FromModel_PrimaryContactModel_UpdatesContact()
        {
            Contact contact = ContactBuilder
                              .Create()
                              .Build();

            PrimaryContactModel inputPrimaryContactModel = new PrimaryContactModel
            {
                FirstName       = Guid.NewGuid().ToString(),
                LastName        = Guid.NewGuid().ToString(),
                EmailAddress    = Guid.NewGuid().ToString(),
                TelephoneNumber = Guid.NewGuid().ToString()
            };

            var actualContact = contact.FromModel(inputPrimaryContactModel);

            Contact expectedContact = ContactBuilder
                                      .Create()
                                      .WithFirstName(inputPrimaryContactModel.FirstName)
                                      .WithLastName(inputPrimaryContactModel.LastName)
                                      .WithEmail(inputPrimaryContactModel.EmailAddress)
                                      .WithPhone(inputPrimaryContactModel.TelephoneNumber)
                                      .Build();

            actualContact.Should().BeEquivalentTo(expectedContact);
        }
Example #3
0
        public void Contact_EqualsContactDifferentLastName_ReturnsFalse()
        {
            var contact  = ContactBuilder.NewContact;
            var contact2 = ContactBuilder.WithLastName("Test last name");

            Assert.NotEqual(contact, contact2);
        }
Example #4
0
        public void sendContactUpdateSignal(string iptoken, Contact contact)   //in a test of the method, original has no return
        {
            string data = ContactBuilder.getSendingControlData(contact);

            sendControlMessage(iptoken, Control.ContactUpdateCc, ContactBuilder.getSendingControlData(contact));
//            return data;
        }
Example #5
0
        public void Contact_EqualsContactDifferentPosition_ReturnsFalse()
        {
            var contact  = ContactBuilder.NewContact;
            var contact2 = ContactBuilder.WithPosition("Test position");

            Assert.NotEqual(contact, contact2);
        }
Example #6
0
        private void OnContactUpdate(object sender, ControlCommandOccuredEventArgs e)
        {
            Contact cnt = ContactBuilder.getContactFromReceivedData(e.data);

            Console.WriteLine("contact update event");
            Console.WriteLine("id" + e.id + "\nmac: " + cnt.mac + "\nname: " + cnt.name + "\ncurrent ip: " + cnt.currentIp);

            if (contacts.ContainsKey(e.id))
            {
                contacts[e.id].updateContact(cnt);

//                MiddleController.getInstance().fileShareController.setupTempOutputFolder(settings.Default.contactPictures);
            }
            else
            {
                Console.WriteLine("Contact id not found for updating..  id: " + e.id);
                Console.Write("contacts now have are: ");

                foreach (var cn in contacts)
                {
                    Console.Write(cn.Key + ",");
                }
                Console.WriteLine();
            }

//            Console.WriteLine("current ip of update comming contact: "+contact.currentIp);
//            contacts[contact.currentIp].updateContact(contact);
        }
Example #7
0
        public Contact AddAddressForContact(int index = 1)
        {
            var     rawTestData        = JObject.Parse(TestDataLocationReader.ContactTestData);
            Contact newContact         = rawTestData["AdditionalAddress"][0].ToObject <Contact>();
            Contact contactWithAddress = new ContactBuilder().WithContactAddress(newContact).BuildContact();

            AddAdditionalAddresses.Click();

            Element addressSection = new Element(By.XPath($"(//app-edit-address)[{index}]"));

            addressSection.Child <Select>(AddressType.GetSelector()).SelectByText(contactWithAddress.AddressType);
            if (contactWithAddress.Primary == true)
            {
                addressSection.Child(Primary.GetSelector()).Click();
            }
            addressSection.Child <Input>(POBox.GetSelector()).SetText(contactWithAddress.POBox);
            addressSection.Child <Select>(Country.GetSelector()).SelectByText(contactWithAddress.Country);
            addressSection.Child <Select>(State.GetSelector()).SelectByText(contactWithAddress.State);
            addressSection.Child <Input>(City.GetSelector()).SetText(contactWithAddress.City);
            addressSection.Child <Input>(Street.GetSelector()).SetText(contactWithAddress.Street);
            addressSection.Child <Input>(Appartment.GetSelector()).SetText(contactWithAddress.Appartment);
            addressSection.Child <Input>(Zip.GetSelector()).SetText(contactWithAddress.Zip);
            addressSection.Child <Select>(ReasonOfReturnedPackages.GetSelector()).SelectByText(contactWithAddress.ReasonOfReturnedPackages);
            return(contactWithAddress);
        }
Example #8
0
            public static Contact WithPosition(string position)
            {
                var builder = new ContactBuilder();

                builder.Position = position;

                return(builder.Build());
            }
Example #9
0
            public static Contact WithLastName(string lastName)
            {
                var builder = new ContactBuilder();

                builder.LastName = lastName;

                return(builder.Build());
            }
Example #10
0
 public Contact(ContactBuilder builder)
 {
     Id        = builder.Id;
     FirstName = builder.FirstName;
     LastName  = builder.LastName;
     PhoneNo   = builder.PhoneNo;
     Email     = builder.Email;
 }
Example #11
0
            public static Contact WithFirstName(string firstName)
            {
                var builder = new ContactBuilder();

                builder.FirstName = firstName;

                return(builder.Build());
            }
Example #12
0
        public void IsSupplierSectionComplete_HasPrimaryContact_ReturnsTrue()
        {
            var order = OrderBuilder
                        .Create()
                        .WithSupplierContact(ContactBuilder.Create().Build())
                        .Build();

            order.IsSupplierSectionComplete().Should().BeTrue();
        }
Example #13
0
        public void Given_AContact_When_NameAndPhone_Should_Create(string name, string phone)
        {
            var sut = ContactBuilder.AContactBuilder()
                      .WithName(name)
                      .WithPhone(phone)
                      .Build();

            Assert.AreEqual(name, sut.Name);
            Assert.AreEqual(phone, sut.Phone);
        }
        public async static Task <Contact> GetContact()
        {
            var builder = new ContactBuilder(new LinkedinRepository(), new GoogleContactsRepository(), "selcuk");

            return(await builder
                   .WithName()
                   .WithSurname()
                   .WithAddress()
                   .Build());
        }
Example #15
0
        public void FromModel_NullPrimaryContactModelModel_ThrowsException()
        {
            Contact contact = ContactBuilder
                              .Create()
                              .Build();

            Assert.Throws <ArgumentNullException>(() =>
            {
                contact.FromModel(null);
            });
        }
Example #16
0
        public void getSendingControlDataTest()
        {
            string data = ContactBuilder.getSendingControlData(new Contact()
            {
                mac = "", name = "sunil", currentIp = "123.23"
            });

            Contact cnt = ContactBuilder.getContactFromReceivedData(data);

            Console.WriteLine("mac: " + cnt.mac + "\nname: " + cnt.name + "\ncurrent ip: " + cnt.currentIp);
        }
Example #17
0
        private void saveChangesBtn_Click_1(object sender, EventArgs e)
        {
            string name = nameText.Text;

            string displayProfile = dp;

            ContactsStore.getInstance().updateMyProfile(ContactBuilder.GetMacAddress(), name, dp);

            mainForm.setMyProfileDetails();
            mainForm.backPic_Click(sender, e);
        }
        public async Task AddAsync_GivenValidContact_ShouldCallSaveChanges()
        {
            //---------------Set up test pack-------------------
            var contact        = ContactBuilder.BuildRandom();
            var dbContext      = Substitute.For <IApplicationDbContext>();
            var contactService = new ContactService(dbContext);

            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            _ = await contactService.AddAsync(contact);

            //---------------Test Result -----------------------
            await dbContext.Received(1).SaveChangesAsync();
        }
        private static Contact CreateRandomContact(int id)
        {
            var contact = new ContactBuilder().WithId(id).WithRandomProps().Build();
            var contactDetailsBuilder = new List <ContactDetail> {
                new ContactDetailsBuilder()
                .WithContactId(contact.ContactId)
                .WithRandomProps()
                .Build()
            };

            contact.ContactDetails = contactDetailsBuilder;

            return(contact);
        }
Example #20
0
        public void Should_AbleToSetContact()
        {
            string title              = "title";
            string version            = "1.0";
            var    contact            = new Contact();
            var    contactWithBuilder = new ContactBuilder().Build();

            var info            = new InfoBuilder(title, version).Contact(contact).Build();
            var infoWithBuilder = new InfoBuilder(title, version).Contact(contactWithBuilder).Build();

            Assert.Equal(title, info.Title);
            Assert.Equal(version, info.Version);
            Assert.Equal(contact, info.Contact);
            Assert.Equal(contactWithBuilder, infoWithBuilder.Contact);
        }
Example #21
0
 protected override void OnModelCreating(ModelBuilder builder)
 {
     MessageBuilder.Build(builder);
     UserBuilder.Build(builder);
     ConversationBuilder.Build(builder);
     FriendsRequestBuilder.Build(builder);
     MessageBuilder.Build(builder);
     UserContactBuilder.Build(builder);
     ContactBuilder.Build(builder);
     NotificationBuilder.Build(builder);
     NotificationTypeBuilder.Build(builder);
     ParticipantBuilder.Build(builder);
     FileStorageBuilder.Build(builder);
     ReadReceiptBuilder.Build(builder);
     MemberBuilder.Build(builder);
 }
Example #22
0
        public void GetContactInfo()
        {
            landingPage.OpenSearchContacts();
            searchPage.RemoveSearchLine(1);
            searchPage.RemoveSearchLine(2);
            searchPage.SetSearchLine(1, "Name", "Ojus");
            searchPage.Search.Click();
            string  name         = searchPage.ContactsSearch.Rows.First().Name.Text;
            Contact firstContact = searchPage.GetContactInfoForRow(1);

            searchPage.ContactsSearch.Rows.First().EditIcon.Click();
            Contact edited = new ContactBuilder().ContactWithDefaultSearchInfo(contactPage.GetContactInfo()).BuildContact();

            Assert.AreEqual(name, $"{edited.LastName}, {edited.FirstName}");
            firstContact.Should().BeEquivalentTo(edited);
        }
Example #23
0
        public Contact EnterOnlyRequiredDataForContact()
        {
            var     rawTestData            = JObject.Parse(TestDataLocationReader.ContactTestData);
            Contact newContact             = rawTestData["NewContact"][0].ToObject <Contact>();
            Contact contactWithReqiredInfo = new ContactBuilder().ContactWithRequiredInfo(newContact).BuildContact();
            string  uniqueName             = contactWithReqiredInfo.FirstName + Guid.NewGuid();

            FirstName.SetText(uniqueName);
            LastName.SetText(contactWithReqiredInfo.LastName);
            CompanyName.SetText(contactWithReqiredInfo.LastName);
            Email.SetText(contactWithReqiredInfo.Email);
            AddressType.SelectByText(contactWithReqiredInfo.AddressType);
            State.SelectByText(contactWithReqiredInfo.State);
            Primary.Click();

            contactWithReqiredInfo.FirstName = uniqueName;
            return(contactWithReqiredInfo);
        }
Example #24
0
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionTrapper;
            string        excelFilename       = args[0];
            string        emailConfigFilename = args[1];
            EmailConfig   eConfig             = GetConfig(emailConfigFilename);
            BirthdayModel birthdays           = new BirthdayModel(ContactBuilder.ReadExcel(excelFilename), DateTime.Today);

            if (birthdays.Contacts.Count() == 0)
            {
                return;
            }
            var tConfig = new TemplateServiceConfiguration()
            {
                DisableTempFileLocking = true,
                TemplateManager        = new ResolvePathTemplateManager(new string[] { AppDomain.CurrentDomain.BaseDirectory }),
                CachingProvider        = new DefaultCachingProvider(t => { }),
            };

            using (var service = RazorEngineService.Create(tConfig)) {
                service.Compile("MonthlyBirthdays", typeof(BirthdayModel));
                string template = service.Run("MonthlyBirthdays", modelType: typeof(BirthdayModel), model: birthdays);
                using (SmtpClient client = new SmtpClient()
                {
                    Host = "smtp.gmail.com",
                    Port = 587,
                    EnableSsl = true,
                    DeliveryMethod = SmtpDeliveryMethod.Network,
                    UseDefaultCredentials = false,
                    Credentials = eConfig.Authentication.AsCredential()
                }) {
                    using (var message = new MailMessage(eConfig.Envelope.From.AsAddress(), eConfig.Envelope.To.AsAddress())
                    {
                        Subject = String.Format("{0:MMMM} Birthdays", birthdays.Month),
                        IsBodyHtml = true,
                        Body = template
                    }) {
                        message.Bcc.Add(eConfig.Envelope.Self.AsAddress());
                        client.Send(message);
                    }
                }
            }
        }
Example #25
0
        public Contact GetContactAdditionalAddress(int index = 1)
        {
            Contact contact        = new Contact();
            Element addressSection = new Element(By.XPath($"(//app-edit-address)[{index}]"));

            contact.AddressType = addressSection.Child <Select>(AddressType.GetSelector()).GetValue;
            contact.Primary     = addressSection.Child(Primary.GetSelector()).Selected;
            contact.POBox       = addressSection.Child <Input>(POBox.GetSelector()).GetValue;
            contact.Country     = addressSection.Child <Select>(Country.GetSelector()).GetValue;
            contact.State       = addressSection.Child <Select>(State.GetSelector()).GetValue;
            contact.City        = addressSection.Child <Input>(City.GetSelector()).GetValue;
            contact.Street      = addressSection.Child <Input>(Street.GetSelector()).GetValue;
            contact.Appartment  = addressSection.Child <Input>(Appartment.GetSelector()).GetValue;
            contact.Zip         = addressSection.Child <Input>(Zip.GetSelector()).GetValue;
            contact.ReasonOfReturnedPackages = addressSection.Child <Select>(ReasonOfReturnedPackages.GetSelector()).GetValue;
            Contact address = new ContactBuilder().WithContactAddress(contact).BuildContact();

            return(address);
        }
        public void Create([FromBody] CustomerDto customerDto)
        {
            Address        address  = new AddressBuilder().Build(customerDto.AddressDto);
            Customer       customer = new CostumerBuilder().Build(customerDto);
            List <Contact> contacts = new ContactBuilder().Build(customerDto.Contacts);

            //Endereços
            _uow.AddressRepository.InsertUnitOfWork(address);

            //Clientes
            customer.AddressId = address.ID;
            _uow.CustomerRepository.InsertUnitOfWork(customer);

            //Contatos
            foreach (var contact in contacts)
            {
                contact.CustomerId = customer.ID;
                _uow.ContactRepository.InsertUnitOfWork(contact);
            }

            _uow.Commit();
        }
Example #27
0
        public void ToModel_Contact_ReturnsPrimaryContactModel()
        {
            Contact contact = ContactBuilder
                              .Create()
                              .WithFirstName(Guid.NewGuid().ToString())
                              .WithLastName(Guid.NewGuid().ToString())
                              .WithEmail(Guid.NewGuid().ToString())
                              .WithPhone(Guid.NewGuid().ToString())
                              .Build();

            var actual = contact.ToModel();

            PrimaryContactModel expected = new PrimaryContactModel
            {
                FirstName       = contact.FirstName,
                LastName        = contact.LastName,
                EmailAddress    = contact.Email,
                TelephoneNumber = contact.Phone
            };

            actual.Should().BeEquivalentTo(expected);
        }
Example #28
0
        public void AfterBuildersTests()
        {
            // Arrange
            for (int i = 1; i <= 3; i++)
            {
                var builder = new ContactBuilder()
                              .WithFirstName($"FirstName{i}")
                              .WithMiddleNames($"MiddleName{i}")
                              .WithLastName($"LastName{i}")
                              .WithEmailAddress($"Email@Emailaddress{i}.com");
                DbContext.Add(builder.Build());
            }
            DbContext.SaveChanges();

            var filter = "Name2";

            // Act
            var actual = _service.GetAll(filter);

            // Assert
            Assert.AreEqual(1, actual.Count);
            Assert.AreEqual("FirstName2", actual.First().FirstName);
        }
Example #29
0
        public async Task MustUpdateUser()
        {
            var userId = Guid.NewGuid();
            var user   = new UserBuilder().WithId(userId).WithFirstName("Dioni").WithLastName("Machado").WithLogin("dioni")
                         .WithPassword("123456").WithLevel(0)
                         .WithContact(new ContactBuilder().WithPhoneNumber("48999281203").WithEmail("*****@*****.**").Build())
                         .WithAddress(new AddressBuilder().WithPostalCode("89062101").WithAddressLine("rua").WithCity("blumenau")
                                      .WithState("sc")
                                      .WithCountry("br").Build())
                         .Active().Build();
            var contact = new ContactBuilder().WithPhoneNumber("48999281203").WithEmail("*****@*****.**").Build();
            var address = new AddressBuilder().WithPostalCode("89062101").WithAddressLine("rua").WithCity("blumenau")
                          .WithState("sc")
                          .WithCountry("br").Build();

            user.Update("avell", "leva", "avell", "54321", 2, contact, address, false);
            user.FirstName.Should().Be("avell");
            user.LastName.Should().Be("leva");
            user.Login.Should().Be("avell");
            user.Level.Should().Be(2);
            user.Contact.Should().BeEquivalentTo(contact);
            user.Address.Should().BeEquivalentTo(address);
            user.Active.Should().BeFalse();
        }
Example #30
0
 public ContactBuilderTest()
 {
     this.builder = new ContactBuilder();
 }
            public static Contact WithFirstName(string firstName)
            {
                var builder = new ContactBuilder();
                builder.FirstName = firstName;

                return builder.Build();
            }
            public static Contact WithPosition(string position)
            {
                var builder = new ContactBuilder();
                builder.Position = position;

                return builder.Build();
            }
            public static Contact WithLastName(string lastName)
            {
                var builder = new ContactBuilder();
                builder.LastName = lastName;

                return builder.Build();
            }