public ContactsShould()
        {
            //Assign
            _loggerMocked      = new Mock <ILogger <Appl.Contacts> >();
            _contactRepoMocked = new Mock <IContactRepo>();
            _mapperMocked      = new Mock <IMapper>();

            _addressAppModel1 = new ApplModels.Address
            {
                ContactId = contactId11,
                Street    = "124",
                City      = "Team city",
                State     = "Hello State",
                ZipCode   = zipcode1
            };

            _appContact1 = new ApplModels.Contact
            {
                FirstName    = "John",
                LastName     = "Doe",
                BusinessName = "NA"
            };

            _contact1 = new DomainModels.Contact
            {
                ContactId    = 1,
                FirstName    = "John",
                LastName     = "Doe",
                BusinessName = "NA",
                Addresses    = new List <DomainModels.Address> {
                    new DomainModels.Address {
                        Street    = "street",
                        City      = "city",
                        State     = "state",
                        ContactId = 1,
                        ZipCode   = "123456"
                    }
                },
                CreatedDate = DateTime.Now.AddDays(-5),
                UpdatedDate = DateTime.Now.AddDays(-4)
            };

            _contact2 = new DomainModels.Contact
            {
                ContactId    = 2,
                FirstName    = "BoA",
                LastName     = "BoA",
                BusinessName = "Bank Of America",
                CreatedDate  = DateTime.Now.AddMonths(-5),
                UpdatedDate  = DateTime.Now
            };

            _mapperMocked.Setup(x => x.Map <ApplModels.Address>(It.IsAny <DomainModels.Address>()))
            .Returns((DomainModels.Address source) => new ApplModels.Address()
            {
                AddressId = 123,
                ContactId = 11,
                Street    = "2727",
                City      = "Houston",
                State     = "Texas",
                ZipCode   = "123456"
            });

            _mapperMocked.Setup(x => x.Map <ApplModels.Contact>(It.IsAny <DomainModels.Contact>()))
            .Returns((DomainModels.Contact source) => new ApplModels.Contact()
            {
                ContactId    = 1,
                FirstName    = FirstName,
                LastName     = LastName,
                BusinessName = BusinessName
            });

            _mapperMocked.Setup(x => x.Map <IEnumerable <ApplModels.Address> >(It.IsAny <IEnumerable <DomainModels.Address> >()))
            .Returns((List <DomainModels.Address> source) => new List <ApplModels.Address>()
            {
                new ApplModels.Address {
                    AddressId = addressId1,
                    ContactId = 11,
                    Street    = "2727",
                    City      = "Houston",
                    State     = "Texas",
                    ZipCode   = zipcode1
                },
                new ApplModels.Address {
                    AddressId = addressId2,
                    ContactId = contactId11,
                    Street    = "2727",
                    City      = "Austin",
                    State     = "Texas",
                    ZipCode   = zipcode2
                },
                new ApplModels.Address {
                    AddressId = addressId3,
                    ContactId = 11,
                    Street    = "1111",
                    City      = "Dallas",
                    State     = "Texas",
                    ZipCode   = zipcode1
                }
            });

            _mapperMocked.Setup(x => x.Map <IEnumerable <ApplModels.Contact> >(It.IsAny <IEnumerable <DomainModels.Contact> >()))
            .Returns((List <DomainModels.Contact> source) => new List <ApplModels.Contact>()
            {
                new ApplModels.Contact {
                    ContactId    = 1,
                    FirstName    = "John",
                    LastName     = "Doe",
                    BusinessName = "NA",
                    Addresses    = new List <ApplModels.Address> {
                        new ApplModels.Address {
                            ContactId = 1, Street = "Street", City = "City"
                        }
                    }
                },
                new ApplModels.Contact {
                    ContactId    = 2,
                    FirstName    = "BoA",
                    LastName     = "BoA",
                    BusinessName = "Bank Of America"
                }
            });

            _contacts = new List <DomainModels.Contact> {
                _contact1, _contact2
            };
        }
Example #2
0
        public AddressesShould()
        {
            //Assign
            _loggerMocked      = new Mock <ILogger <Addresses> >();
            _addressRepoMocked = new Mock <IAddressRepo>();
            _mapperMocked      = new Mock <IMapper>();

            _addressAppModel1 = new ApplModels.Address
            {
                ContactId = contactId11,
                Street    = "124",
                City      = "Team city",
                State     = "Hello State",
                ZipCode   = zipcode1
            };

            _address1 = new DomainModels.Address
            {
                AddressId   = addressId1,
                ContactId   = contactId11,
                Street      = "2727",
                City        = "Houston",
                State       = "Texas",
                ZipCode     = zipcode1,
                CreatedDate = DateTime.Now.AddDays(-5),
                UpdatedDate = DateTime.Now.AddDays(-4)
            };

            _address2 = new DomainModels.Address
            {
                AddressId   = addressId2,
                ContactId   = contactId12,
                Street      = "2727",
                City        = "Austin",
                State       = "Texas",
                ZipCode     = zipcode2,
                CreatedDate = DateTime.Now.AddMonths(-5),
                UpdatedDate = DateTime.Now
            };

            _mapperMocked.Setup(x => x.Map <ApplModels.Address>(It.IsAny <DomainModels.Address>()))
            .Returns((DomainModels.Address source) => new ApplModels.Address()
            {
                AddressId = addressId1,
                ContactId = 11,
                Street    = "2727",
                City      = "Houston",
                State     = "Texas",
                ZipCode   = zipcode1
            });

            _mapperMocked.Setup(x => x.Map <IEnumerable <ApplModels.Address> >(It.IsAny <IEnumerable <DomainModels.Address> >()))
            .Returns((List <DomainModels.Address> source) => new List <ApplModels.Address>()
            {
                new ApplModels.Address {
                    AddressId = addressId1,
                    ContactId = 11,
                    Street    = "2727",
                    City      = "Houston",
                    State     = "Texas",
                    ZipCode   = zipcode1
                },
                new ApplModels.Address {
                    AddressId = addressId2,
                    ContactId = contactId11,
                    Street    = "2727",
                    City      = "Austin",
                    State     = "Texas",
                    ZipCode   = zipcode2
                },
                new ApplModels.Address {
                    AddressId = addressId3,
                    ContactId = 11,
                    Street    = "1111",
                    City      = "Dallas",
                    State     = "Texas",
                    ZipCode   = zipcode1
                }
            });

            _addresses = new List <DomainModels.Address> {
                _address1, _address2
            };
        }