static void Main(string[] args)
        {
            // Cat cat = new Dog();
            // Cat cat = (Cat)new Dog();
            // Cat cat = new Dog().AsCat();
            Cat cat = new WrappedDog(new Dog());


            IExpectAlternateContact spec =
                UserSpecification
                .ForPerson()
                .WithName("Max")
                .WithSurname("Planck")
                .WithPrimaryContact(
                    ContactSpecification.ForEmailAddress("*****@*****.**"));

            IBuildingSpecification <EmailAddress> contact =
                ContactSpecification.ForEmailAddress("*****@*****.**");

            if (!spec.CanAdd(contact))
            {
                Console.WriteLine("Cannot add desired contact...");
            }
            else
            {
                spec = spec.WithAlternateContact(contact);
                IUser user = spec.AndNoMoreContacts().Build();
                Console.WriteLine(user);
            }

            Console.ReadLine();
        }
Exemple #2
0
        static void Main(string[] args)
        {
            IUser user =
                UserSpecification
                .ForMachine()
                .ProducedBy(
                    ProducerSpecification
                    .WithName("Big Co."))
                .WithModel("Shiny one")
                .OwnedBy(
                    LegalEntitySpecification
                    .Initialize()
                    .WithCompanyName("Properties Co.")
                    .WithEmailAddress(
                        ContactSpecification.ForEmailAddress("one@prop"))
                    .WithPhoneNumber(
                        ContactSpecification
                        .ForPhoneNumber()
                        .WithCountryCode(1)
                        .WithAreaCode(23)
                        .WithNumber(456))
                    .WithOtherContact(
                        ContactSpecification.ForEmailAddress("two@prop"))
                    .AndNoMoreContacts())
                .Build();

            Console.WriteLine(user);

            Console.WriteLine();
            Console.ReadLine();
        }
Exemple #3
0
        /// <summary>
        /// Searches the contacts.
        /// </summary>
        /// <returns></returns>
        private async Task SearchContacts()
        {
            EnterBusyState();
            var spec     = new ContactSpecification(SearchKey, SearchFields);
            var contacts = await Task.Run(() => Controller.GetContacts(spec));

            RefreshView(contacts.ToList());
            ExitBusyState();
        }
Exemple #4
0
        /// <summary>
        /// Gets the contacts.
        /// </summary>
        /// <param name="spec">The spec.</param>
        /// <returns>The contacts.</returns>
        public IEnumerable <ContactModel> GetContacts(ContactSpecification spec)
        {
            var entitySpec = new EntitySpecification <ContactModel>(spec.Predicate);

            return(repository.GetBySpecification(entitySpec));
        }
Exemple #5
0
        /// <summary>
        /// Gets the contacts.
        /// </summary>
        /// <param name="spec">The spec.</param>
        /// <returns>
        /// The task.
        /// </returns>
        public async Task <IEnumerable <ContactModel> > GetContacts(ContactSpecification spec)
        {
            await Task.Delay(30000);

            return(await Task.Run(() => Service.GetContacts(spec)));
        }