예제 #1
0
        public void SetUp()
        {
            var emailTemplates = new List <Entities.EmailTemplate>
            {
                new Entities.EmailTemplate
                {
                    Id       = 1,
                    Type     = "WelcomeCompanyCustomer",
                    Subject  = "Welcome Company Customer",
                    Template = "This is template example for company (#CompanyName#)"
                },
                new Entities.EmailTemplate
                {
                    Id       = 2,
                    Type     = "WelcomeUser",
                    Subject  = "User Template",
                    Template = "This is template example for user (#UserLogin#)"
                }
            };

            _placeholders = new Dictionary <string, string>
            {
                { "(#CompanyName#)", "CloudPlus" },
                { "(#UserLogin#)", "*****@*****.**" },
                { "(#Nonexistent#)", "*****@*****.**" }
            };

            var emailTemplatesDbSet = MockSetGenerator.CreateMockSet(emailTemplates);
            var dbContextMock       = new Mock <CldpDbContext>();

            dbContextMock.Setup(p => p.EmailTemplates).Returns(emailTemplatesDbSet);
            _sut = new Database.EmailNotifications.EmailTemplateService(dbContextMock.Object);
        }
        public void SetUp()
        {
            var domains = new List <Entities.Domain>
            {
                new Entities.Domain
                {
                    Id        = 1,
                    Name      = "First Domain",
                    CompanyId = 1
                },
                new Entities.Domain
                {
                    Id        = 2,
                    Name      = "Second Domain",
                    CompanyId = 1
                },
                new Entities.Domain
                {
                    Id        = 3,
                    Name      = "Third Domain",
                    CompanyId = 2
                },
            };

            var domainsDbSet  = MockSetGenerator.CreateMockSet(domains);
            var dbContextMock = new Mock <CldpDbContext>();

            dbContextMock.Setup(c => c.Domains).Returns(domainsDbSet);

            _sut = new Database.Domain.DomainService(dbContextMock.Object);
        }
        public void Setup()
        {
            var companies = new List <Entities.Company>
            {
                new Entities.Company
                {
                    Id               = 1,
                    Name             = "First Company",
                    UniqueIdentifier = "ui1"
                },
                new Entities.Company
                {
                    Id               = 2,
                    Name             = "Second Company",
                    UniqueIdentifier = "ui2"
                },
                new Entities.Company
                {
                    Id               = 3,
                    Name             = "Third Company",
                    UniqueIdentifier = "ui3"
                },
            };

            var companiesDbSet = MockSetGenerator.CreateMockSet(companies);
            var dbContextMock  = new Mock <CldpDbContext>();

            dbContextMock.Setup(c => c.Companies).Returns(companiesDbSet);

            var userServiceMock = new Mock <IUserService>();

            _sut = new Database.Company.CompanyService(dbContextMock.Object, userServiceMock.Object);
        }
        public void Setup()
        {
            var grandchildCompany = new Entities.Company
            {
                Id   = 3,
                Name = "Grand Child Company",
            };

            var childCompany = new Entities.Company
            {
                Id          = 2,
                Name        = "Child Company",
                MyCompanies = new List <Entities.Company> {
                    grandchildCompany
                }
            };

            var parentCompany = new Entities.Company
            {
                Id          = 1,
                Name        = "Parent Company",
                MyCompanies = new List <Entities.Company> {
                    childCompany
                }
            };

            var companies = new List <Entities.Company>
            {
                parentCompany,
                childCompany,
                grandchildCompany
            };

            var companiesDbSet = MockSetGenerator.CreateMockSet(companies);
            var dbContextMock  = new Mock <CldpDbContext>();

            dbContextMock.Setup(c => c.Companies).Returns(companiesDbSet);

            var userServiceMock = new Mock <IUserService>();

            _sut = new Database.Company.CompanyService(dbContextMock.Object, userServiceMock.Object);
        }
예제 #5
0
        public void Setup()
        {
            var productItems = new List <Entities.Catalog.ProductItem>
            {
                new Entities.Catalog.ProductItem
                {
                    Id   = 1,
                    Name = "Office 365 Business Essentials"
                },
                new Entities.Catalog.ProductItem
                {
                    Id   = 2,
                    Name = "Office 365 Enterprise E5 (without PSTN Conferencing)"
                }
            };

            var productItemsDbSet = MockSetGenerator.CreateMockSet(productItems);
            var dbContextMock     = new Mock <CldpDbContext>();

            dbContextMock.Setup(c => c.ProductItems).Returns(productItemsDbSet);
            _sut = new Database.ProductItem.ProductItemService(dbContextMock.Object);
        }
예제 #6
0
 public void Init()
 {
     _configurationManager = new Mock <IConfigurationManager>();
     _dbContext            = new Mock <CloudPlusAuthDbContext>();
     _usersMock            = new List <User>
     {
         new User
         {
             UserName         = "******",
             Email            = "*****@*****.**",
             EmailConfirmed   = true,
             FirstName        = "Dalila",
             LastName         = "Avdukic",
             IsActive         = true,
             AlternativeEmail = "*****@*****.**",
             CompanyId        = 3,
             LockoutEnabled   = true
         },
         new User
         {
             UserName         = "******",
             Email            = "*****@*****.**",
             EmailConfirmed   = true,
             FirstName        = "Amer",
             LastName         = "Ratkovic",
             IsActive         = true,
             AlternativeEmail = "*****@*****.**",
             CompanyId        = 3,
             LockoutEnabled   = true
         },
         new User
         {
             UserName         = "******",
             Email            = "*****@*****.**",
             EmailConfirmed   = true,
             FirstName        = "Faris",
             LastName         = "Fetahagic",
             IsActive         = true,
             AlternativeEmail = "*****@*****.**",
             CompanyId        = 3,
             LockoutEnabled   = true
         },
         new User
         {
             UserName         = "******",
             Email            = "*****@*****.**",
             EmailConfirmed   = true,
             FirstName        = "Mersiha",
             LastName         = "Seljpic",
             IsActive         = true,
             AlternativeEmail = "*****@*****.**",
             CompanyId        = 3,
             LockoutEnabled   = true
         },
         new User
         {
             UserName         = "******",
             Email            = "*****@*****.**",
             EmailConfirmed   = true,
             FirstName        = "Uzeir",
             LastName         = "Basic",
             IsActive         = true,
             AlternativeEmail = "*****@*****.**",
             CompanyId        = 3,
             LockoutEnabled   = true
         },
         new User
         {
             UserName         = "******",
             Email            = "*****@*****.**",
             EmailConfirmed   = true,
             FirstName        = "Emir",
             LastName         = "Kljucanin",
             IsActive         = true,
             AlternativeEmail = "*****@*****.**",
             CompanyId        = 3,
             LockoutEnabled   = true
         },
         new User
         {
             UserName         = "******",
             Email            = "*****@*****.**",
             EmailConfirmed   = true,
             FirstName        = "Seid",
             LastName         = "Solak",
             IsActive         = true,
             AlternativeEmail = "*****@*****.**",
             CompanyId        = 3,
             LockoutEnabled   = true
         },
         new User
         {
             UserName         = "******",
             Email            = "*****@*****.**",
             EmailConfirmed   = true,
             FirstName        = "Adnan",
             LastName         = "Mulalic",
             IsActive         = true,
             AlternativeEmail = "*****@*****.**",
             CompanyId        = 3,
             LockoutEnabled   = true
         }
     }.AsQueryable();
     _userMockSet = MockSetGenerator.CreateMockSet(_usersMock);
     _dbContext.SetupGet(c => c.Users).Returns(_userMockSet.Object);
 }
        public void Setup()
        {
            var companies = new List <Entities.Company>
            {
                // main company
                new Entities.Company
                {
                    Id   = 1,
                    Name = "Parent Company",
                    Type = 0
                },
                // reseller children of main company
                new Entities.Company
                {
                    Id       = 2,
                    Name     = "First Reseller Company",
                    ParentId = 1,
                    Type     = 0
                },
                new Entities.Company
                {
                    Id       = 3,
                    Name     = "Second Reseller Company",
                    ParentId = 1,
                    Type     = 0
                },
                new Entities.Company
                {
                    Id       = 4,
                    Name     = "Third Reseller Company",
                    ParentId = 1,
                    Type     = 0
                },
                // customer children of main company
                new Entities.Company
                {
                    Id       = 5,
                    Name     = "First Customer Company",
                    ParentId = 1,
                    Type     = 1
                },
                new Entities.Company
                {
                    Id       = 6,
                    Name     = "Second Customer Company",
                    ParentId = 1,
                    Type     = 1
                },
                new Entities.Company
                {
                    Id       = 7,
                    Name     = "Third Customer Company",
                    ParentId = 1,
                    Type     = 1
                },
                // reseller companies which are not children of main company
                new Entities.Company
                {
                    Id       = 8,
                    Name     = "Other's Reseller Company",
                    ParentId = 2,
                    Type     = 0
                },
                // customer companies which are not children of main company
                new Entities.Company
                {
                    Id       = 9,
                    Name     = "Other's Customer Company",
                    ParentId = 2,
                    Type     = 1
                },
            };

            var companiesDbSet = MockSetGenerator.CreateMockSet(companies);
            var dbContextMock  = new Mock <CldpDbContext>();

            dbContextMock.Setup(c => c.Companies).Returns(companiesDbSet);

            var userServiceMock = new Mock <IUserService>();

            _sut = new Database.Company.CompanyService(dbContextMock.Object, userServiceMock.Object);
        }