예제 #1
0
        public UpdateMineTests(CustomWebApplicationFactoryWithMariaDb <JinCreek.Server.Admin.Startup> factory)
        {
            _client  = factory.CreateClient();
            _context = factory.Services.GetService <IServiceScopeFactory>().CreateScope().ServiceProvider.GetService <MainDbContext>();

            Utils.RemoveAllEntities(_context);

            _context.Add(_org1    = Utils.CreateOrganization(code: 1, name: "org1"));
            _context.Add(_org2    = Utils.CreateOrganization(code: 2, name: "org2"));
            _context.Add(_domain1 = new Domain {
                Id = Guid.NewGuid(), Name = "domain01", Organization = _org1
            });
            _context.Add(_domain2 = new Domain {
                Id = Guid.NewGuid(), Name = "domain02", Organization = _org2
            });
            _context.Add(_userGroup1 = new UserGroup {
                Id = Guid.NewGuid(), Name = "userGroup1", Domain = _domain1
            });
            _context.Add(_userGroup2 = new UserGroup {
                Id = Guid.NewGuid(), Name = "userGroup2", Domain = _domain2
            });
            _context.Add(new SuperAdmin {
                AccountName = "user0", Name = "", Password = Utils.HashPassword("user0")
            });                                                                                                        // スーパー管理者
            _context.Add(new UserAdmin {
                AccountName = "user1", Name = "", Password = Utils.HashPassword("user1"), Domain = _domain1
            });                                                                                                                          // ユーザー管理者
            _context.Add(_simGroup1 = Utils.CreateSimGroup(organization: _org1, name: "simGroup1", isolatedNw1IpPool: "isolatedNw1IpPool"));
            _context.Add(_simGroup2 = Utils.CreateSimGroup(organization: _org2, name: "simGroup2", isolatedNw1IpPool: "isolatedNw1IpPool"));
            _context.SaveChanges();
        }
예제 #2
0
        public RegisterTests(CustomWebApplicationFactoryWithMariaDb <Admin.Startup> factory)
        {
            _client  = factory.CreateClient();
            _context = factory.Services.GetService <IServiceScopeFactory>().CreateScope().ServiceProvider.GetService <MainDbContext>();
            Utils.RemoveAllEntities(_context);

            _context.Add(_org1    = Utils.CreateOrganization(code: 1, name: "org1"));
            _context.Add(_domain1 = new Domain {
                Id = Guid.NewGuid(), Name = "domain01", Organization = _org1
            });
            _context.Add(_user1 = new SuperAdmin {
                AccountName = "user0", Name = "user0", Password = Utils.HashPassword("user0")
            });                                                                                                                      // スーパー管理者
            _context.Add(_user2 = new UserAdmin {
                AccountName = "user1", Name = "user1", Password = Utils.HashPassword("user1"), Domain = _domain1
            });                                                                                                                                        // ユーザー管理者
            _context.Add(_simGroup1 = new SimGroup()
            {
                Id                      = Guid.NewGuid(),
                Name                    = "simGroup1",
                Organization            = _org1,
                Apn                     = "apn",
                AuthenticationServerIp  = "AuthenticationServerIp",
                IsolatedNw1IpPool       = "IsolatedNw1IpPool",
                IsolatedNw1SecondaryDns = "IsolatedNw1SecondaryDns",
                IsolatedNw1IpRange      = "IsolatedNw1IpRange",
                IsolatedNw1PrimaryDns   = "IsolatedNw1PrimaryDns",
                NasIp                   = "NasIp",
                PrimaryDns              = "PrimaryDns",
                SecondaryDns            = "SecondaryDns",
                UserNameSuffix          = "UserNameSuffix",
            });
            _context.SaveChanges();
        }
예제 #3
0
        public UpdateMineTests(CustomWebApplicationFactoryWithMariaDb <Admin.Startup> factory)
        {
            _client         = factory.CreateClient();
            using var scope = factory.Services.GetService <IServiceScopeFactory>().CreateScope();
            var context = scope.ServiceProvider.GetService <MainDbContext>();

            var org1    = Utils.CreateOrganization(code: 1, name: "org1");
            var org2    = Utils.CreateOrganization(code: 2, name: "org2");
            var domain1 = new Domain {
                Id = Guid.Parse("93b25287-7516-4051-9c8e-d114fad099ab"), Name = "domain1", Organization = org1
            };
            var user0 = new SuperAdmin {
                AccountName = "user0", Name = "", Password = Utils.HashPassword("user0")
            };                                                                                                       // スーパー管理者
            var user1 = new UserAdmin {
                AccountName = "user1", Name = "", Password = Utils.HashPassword("user1"), Domain = domain1
            };                                                                                                                        // ユーザー管理者

            Utils.RemoveAllEntities(context);
            context.Add(org1);
            context.Add(org2);
            context.Add(domain1);
            context.Add(user0);
            context.Add(user1);
            context.SaveChanges();
        }
예제 #4
0
        public ListingMineTests(CustomWebApplicationFactoryWithMariaDb <JinCreek.Server.Admin.Startup> factory)
        {
            _client  = factory.CreateClient();
            _context = factory.Services.GetService <IServiceScopeFactory>().CreateScope().ServiceProvider.GetService <MainDbContext>();

            Utils.RemoveAllEntities(_context);

            _context.Add(_org1    = Utils.CreateOrganization(code: 1, name: "org1"));
            _context.Add(_org2    = Utils.CreateOrganization(code: 2, name: "org2"));
            _context.Add(_domain1 = new Domain {
                Id = Guid.NewGuid(), Name = "domain1", OrganizationCode = _org1.Code
            });
            _context.Add(_domain2 = new Domain {
                Id = Guid.NewGuid(), Name = "domain2", OrganizationCode = _org2.Code
            });
            _context.Add(_user0 = new SuperAdmin {
                AccountName = "user0", Name = "", Password = Utils.HashPassword("user0")
            });                                                                                                                 // スーパー管理者
            _context.Add(_user1 = new UserAdmin {
                AccountName = "user1", Name = "", Password = Utils.HashPassword("user1"), Domain = _domain1
            });                                                                                                                                   // ユーザー管理者
            _context.Add(_user2 = new GeneralUser {
                AccountName = "xuser2a", Name = "", Domain = _domain1
            });
            _context.Add(_simGroup1 = Utils.CreateSimGroup(organization: _org1, name: "simGroup1", isolatedNw1IpPool: "isolatedNw1IpPool"));
            _context.Add(_simGroup2 = Utils.CreateSimGroup(organization: _org2, name: "simGroup2", isolatedNw1IpPool: "isolatedNw1IpPool"));
            _context.Add(_sim1A     = new Sim {
                SimGroup = _simGroup1, Msisdn = "1", Imsi = "1a", IccId = "1a", UserName = "******", Password = "******"
            });
            _context.Add(_sim1B = new Sim {
                SimGroup = _simGroup1, Msisdn = "0123456789", Imsi = "1b", IccId = "1b", UserName = "******", Password = "******"
            });
            _context.Add(_sim2 = new Sim {
                SimGroup = _simGroup2, Msisdn = "2", Imsi = "2", IccId = "2", UserName = "******", Password = "******"
            });
            _context.Add(_device1    = Utils.CreateDevice(domain: _domain1, name: "device1"));
            _context.Add(_device2    = Utils.CreateDevice(domain: _domain1, name: "xdevice2a"));
            _context.Add(_simDevice1 = new SimAndDevice {
                Id = Guid.NewGuid(), SimId = _sim1A.Id, Device = _device1, IsolatedNw2Ip = ""
            });
            _context.Add(_simDevice2 = new SimAndDevice {
                Id = Guid.NewGuid(), SimId = _sim1A.Id, Device = _device2, IsolatedNw2Ip = ""
            });
            _context.Add(_multiFactor1 = new MultiFactor {
                Id = Guid.NewGuid(), SimAndDevice = _simDevice1, EndUserId = _user1.Id, ClosedNwIp = ""
            });
            _context.Add(_multiFactor2 = new MultiFactor {
                Id = Guid.NewGuid(), SimAndDevice = _simDevice2, EndUserId = _user2.Id, ClosedNwIp = ""
            });

            //_context.Add(new SimAndDeviceAuthenticationSuccessLog { Id = Guid.NewGuid(), SimAndDevice = _simDevice1 });
            //_context.Add(new SimAndDeviceAuthenticationFailureLog { Id = Guid.NewGuid(), Sim = _sim1 });
            //_context.Add(new MultiFactorAuthenticationSuccessLog { Id = Guid.NewGuid(), MultiFactor = _factorCombination1 });
            //_context.Add(new MultiFactorAuthenticationFailureLog { Id = Guid.NewGuid(), SimAndDevice = _simDevice1 });
            //_context.Add(new DeauthenticationLog { Id = Guid.NewGuid(), MultiFactor = _factorCombination1 });
            _context.SaveChanges();
        }
예제 #5
0
        public ListingTests(CustomWebApplicationFactoryWithMariaDb <Admin.Startup> factory)
        {
            _client  = factory.CreateClient();
            _context = factory.Services.GetService <IServiceScopeFactory>().CreateScope().ServiceProvider.GetService <MainDbContext>();

            Utils.RemoveAllEntities(_context);
            _context.Add(new SuperAdmin {
                AccountName = "user0", Name = "user0", Password = Utils.HashPassword("user0")
            });                                                                                                             // スーパー管理者
            _context.SaveChanges();
        }
예제 #6
0
        public DeleteTests(CustomWebApplicationFactoryWithMariaDb <JinCreek.Server.Admin.Startup> factory)
        {
            _client  = factory.CreateClient();
            _context = factory.Services.GetService <IServiceScopeFactory>().CreateScope().ServiceProvider.GetService <MainDbContext>();
            Utils.RemoveAllEntities(_context);

            _context.Add(_org1    = Utils.CreateOrganization(code: 1, name: "org1"));
            _context.Add(_domain1 = new Domain {
                Id = Guid.NewGuid(), Name = "domain01", Organization = _org1
            });
            _context.Add(_user1 = new SuperAdmin {
                Name = "", AccountName = "user0", Password = Utils.HashPassword("user0")
            });                                                                                                               // スーパー管理者
            _context.Add(_user2 = new UserAdmin {
                Name = "", AccountName = "user1", Password = Utils.HashPassword("user1"), Domain = _domain1
            });                                                                                                                                   // ユーザー管理者
            _context.Add(_simGroup1 = new SimGroup()
            {
                Id                      = Guid.NewGuid(),
                Name                    = "simGroup1",
                Organization            = _org1,
                Apn                     = "apn",
                AuthenticationServerIp  = "AuthenticationServerIp",
                IsolatedNw1IpPool       = "IsolatedNw1IpPool",
                IsolatedNw1SecondaryDns = "IsolatedNw1SecondaryDns",
                IsolatedNw1IpRange      = "IsolatedNw1IpRange",
                IsolatedNw1PrimaryDns   = "IsolatedNw1PrimaryDns",
                NasIp                   = "NasIp",
                PrimaryDns              = "PrimaryDns",
                SecondaryDns            = "SecondaryDns",
                UserNameSuffix          = ""
            });
            _context.Add(_sim = new Sim()
            {
                SimGroup = _simGroup1,
                Msisdn   = "1001",
                Imsi     = "1001",
                IccId    = "1001",
                UserName = "******",
                Password = "******"
            });
            _context.Add(_device1 = new Device()
            {
                Domain        = _domain1,
                Name          = "device01",
                UseTpm        = true,
                ManagedNumber = "001",
                WindowsSignInListCacheDays = 1,
                ProductName  = "",
                SerialNumber = ""
            });
            _context.SaveChanges();
        }
예제 #7
0
        public CsvImportTests(CustomWebApplicationFactoryWithMariaDb <JinCreek.Server.Admin.Startup> factory)
        {
            _client  = factory.CreateClient();
            _context = factory.Services.GetService <IServiceScopeFactory>().CreateScope().ServiceProvider.GetService <MainDbContext>();

            Utils.RemoveAllEntities(_context);

            _context.Add(_org1    = Utils.CreateOrganization(code: 1, name: "org1"));
            _context.Add(_org2    = Utils.CreateOrganization(code: 2, name: "org2"));
            _context.Add(_domain1 = new Domain {
                Id = Guid.NewGuid(), Name = "domain1", Organization = _org1
            });
            _context.Add(_domain2 = new Domain {
                Id = Guid.NewGuid(), Name = "domain2", Organization = _org2
            });
            _context.Add(_userGroup1 = new UserGroup {
                Id = Guid.NewGuid(), Name = "userGroup1", Domain = _domain1
            });
            _context.Add(_userGroup2 = new UserGroup {
                Id = Guid.NewGuid(), Name = "userGroup2", Domain = _domain2
            });
            _context.Add(_deviceGroup1 = new DeviceGroup {
                Id = Guid.NewGuid(), Name = "deviceGroup1", Domain = _domain1
            });
            _context.Add(_deviceGroup2 = new DeviceGroup {
                Id = Guid.NewGuid(), Name = "deviceGroup2", Domain = _domain2
            });
            _context.Add(_lte1 = new LteModule {
                Id = Guid.NewGuid(), Name = "lte1", NwAdapterName = ""
            });
            _context.Add(_lte1 = new LteModule {
                Id = Guid.NewGuid(), Name = "lte2", NwAdapterName = ""
            });
            _context.Add(new SuperAdmin {
                Name = "", AccountName = "user0", Password = Utils.HashPassword("user0")
            });                                                                                                        // スーパー管理者
            _context.Add(new UserAdmin {
                Name = "", AccountName = "user1", Password = Utils.HashPassword("user1"), Domain = _domain1
            });                                                                                                                          // ユーザー管理者
            _context.Add(_clientOs1 = new ClientOs {
                Id = Guid.NewGuid(), Name = "Windows 10"
            });
            _context.Add(_clientApp1 = new ClientApp {
                Id = Guid.NewGuid(), ClientOs = _clientOs1, Version = "1903"
            });
            _context.Add(_organizationClientApp1 = new OrganizationClientApp {
                Id = Guid.NewGuid(), Organization = _org1, ClientApp = _clientApp1
            });
            _context.SaveChanges();
        }
예제 #8
0
        public RegisterTests(CustomWebApplicationFactoryWithMariaDb <Admin.Startup> factory)
        {
            _client  = factory.CreateClient();
            _context = factory.Services.GetService <IServiceScopeFactory>().CreateScope().ServiceProvider.GetService <MainDbContext>();

            Utils.RemoveAllEntities(_context);
            _context.Add(_org1    = Utils.CreateOrganization(code: 1, name: "org1"));
            _context.Add(_domain1 = new Domain {
                Name = "domain1", Organization = _org1
            });
            _context.Add(new SuperAdmin {
                AccountName = "user0", Name = "", Password = Utils.HashPassword("user0")
            });
            _context.Add(new UserAdmin {
                AccountName = "user1", Name = "", Password = Utils.HashPassword("user1"), Domain = _domain1
            });
            _context.SaveChanges();
        }
예제 #9
0
        public UpdateTests(CustomWebApplicationFactoryWithMariaDb <Admin.Startup> factory)
        {
            _client  = factory.CreateClient();
            _context = factory.Services.GetService <IServiceScopeFactory>().CreateScope().ServiceProvider.GetService <MainDbContext>();

            Utils.RemoveAllEntities(_context);

            _context.Add(_org1      = Utils.CreateOrganization(code: 1, name: "org1"));
            _context.Add(_org2      = Utils.CreateOrganization(code: 2, name: "org2"));
            _context.Add(_clientOs1 = new ClientOs {
                Id = Guid.NewGuid(), Name = "Windows 10"
            });
            _context.Add(_clientApp1 = new ClientApp {
                Id = Guid.NewGuid(), ClientOs = _clientOs1, Version = "1903"
            });
            _context.Add(_organizationClientApp1 = new OrganizationClientApp {
                Id = Guid.NewGuid(), Organization = _org1, ClientApp = _clientApp1
            });
            _context.Add(_domain1 = new Domain {
                Id = Guid.NewGuid(), Name = "domain01", Organization = _org1
            });
            _context.Add(_domain2 = new Domain {
                Id = Guid.NewGuid(), Name = "domain02", Organization = _org2
            });
            _context.Add(_userGroup1 = new UserGroup {
                Id = Guid.NewGuid(), Name = "userGroup1", Domain = _domain1
            });
            _context.Add(_userGroup2 = new UserGroup {
                Id = Guid.NewGuid(), Name = "userGroup2", Domain = _domain2
            });
            _context.Add(_deviceGroup1 = new DeviceGroup {
                Id = Guid.NewGuid(), Name = "deviceGroup1", Domain = _domain1
            });
            _context.Add(_deviceGroup2 = new DeviceGroup {
                Id = Guid.NewGuid(), Name = "deviceGroup2", Domain = _domain2
            });
            _context.Add(_device1 = new Device {
                OrganizationClientApp = _organizationClientApp1, Name = "device1", ManagedNumber = "1", Domain = _domain1, DeviceGroupDevices = new HashSet <DeviceGroupDevice> {
                    new DeviceGroupDevice {
                        DeviceGroup = _deviceGroup1
                    }
                }, WindowsSignInListCacheDays = 0
            });
            _context.Add(_device1B = new Device {
                OrganizationClientApp = _organizationClientApp1, Name = "device1b", ManagedNumber = "2", Domain = _domain1, DeviceGroupDevices = new HashSet <DeviceGroupDevice> {
                    new DeviceGroupDevice {
                        DeviceGroup = _deviceGroup1
                    }
                }, WindowsSignInListCacheDays = 0
            });
            _context.Add(_device2 = new Device {
                OrganizationClientApp = _organizationClientApp1, Name = "device2", ManagedNumber = "1", Domain = _domain2, DeviceGroupDevices = new HashSet <DeviceGroupDevice> {
                    new DeviceGroupDevice {
                        DeviceGroup = _deviceGroup2
                    }
                }, WindowsSignInListCacheDays = 0
            });
            _context.Add(_lte1 = new LteModule {
                Id = Guid.NewGuid(), Name = "lte1", NwAdapterName = "", UseSoftwareRadioState = true
            });
            _context.Add(new SuperAdmin {
                AccountName = "user0", Name = "user0", Password = Utils.HashPassword("user0")
            });                                                                                                           // スーパー管理者
            _context.Add(new UserAdmin {
                AccountName = "user1", Name = "user1", Password = Utils.HashPassword("user1"), Domain = _domain1
            });                                                                                                                               // ユーザー管理者
            _context.SaveChanges();
        }
예제 #10
0
        public RegisterMineTests(CustomWebApplicationFactoryWithMariaDb <Startup> factory)
        {
            _client  = factory.CreateClient();
            _context = factory.Services.GetService <IServiceScopeFactory>().CreateScope().ServiceProvider.GetService <MainDbContext>();
            Utils.RemoveAllEntities(_context);

            _context.Add(_org1    = Utils.CreateOrganization(code: 1, name: "org1", startDate: DateTime.Parse("2020-01-14"), endDate: DateTime.Parse("2021-01-30")));
            _context.Add(_org2    = Utils.CreateOrganization(code: 2, name: "org2", startDate: DateTime.Parse("2020-01-14"), endDate: DateTime.Parse("2021-01-30")));
            _context.Add(_domain1 = new Domain {
                Id = Guid.NewGuid(), Name = "domain01", Organization = _org1
            });
            _context.Add(_domain2 = new Domain {
                Id = Guid.NewGuid(), Name = "domain02", Organization = _org2
            });
            _context.Add(_userGroup1 = new UserGroup {
                Id = Guid.NewGuid(), Domain = _domain1, Name = "userGroup1"
            });
            _context.Add(_user1 = new SuperAdmin {
                AccountName = "user0", Name = "user0", Password = Utils.HashPassword("user0")
            });                                                                                                                     // スーパー管理者
            _context.Add(_user2 = new UserAdmin {
                AccountName = "user1", Name = "user1", Password = Utils.HashPassword("user1"), Domain = _domain1
            });                                                                                                                                       // ユーザー管理者
            _context.Add(_user3 = new GeneralUser {
                AccountName = "user2", Name = "user2", Domain = _domain1
            });
            _context.Add(new UserGroupEndUser {
                EndUser = _user2, UserGroup = _userGroup1
            });
            _context.Add(new AvailablePeriod {
                EndUser = _user2, EndDate = DateTime.Parse("2021-03-01"), StartDate = DateTime.Parse("2020-02-10")
            });
            _context.Add(new AvailablePeriod {
                EndUser = _user3, EndDate = DateTime.Parse("2021-03-01"), StartDate = DateTime.Parse("2020-02-10")
            });
            _context.Add(_user4 = new GeneralUser {
                AccountName = "user4", Name = "user4", Domain = _domain2
            });
            _context.Add(_deviceGroup1 = new DeviceGroup {
                Id = Guid.NewGuid(), Name = "_deviceGroup1", Domain = _domain1
            });
            _context.Add(_lteModule1 = new LteModule {
                Name = "lte1", UseSoftwareRadioState = true, NwAdapterName = "abc"
            });
            _context.Add(_device1 = new Device
            {
                LteModule     = _lteModule1,
                Domain        = _domain1,
                Name          = "device01",
                UseTpm        = true,
                ManagedNumber = "001",
                WindowsSignInListCacheDays = 1,
            });
            _context.Add(_device2 = new Device() // 他組織
            {
                LteModule     = _lteModule1,
                Domain        = _domain2,
                Name          = "device02",
                UseTpm        = true,
                ManagedNumber = "001",
                WindowsSignInListCacheDays = 1,
            });

            _context.Add(_simGroup1 = Utils.CreateSimGroup(organization: _org1, name: "simGroup1", isolatedNw1IpPool: "Nw1IpAddressPool"));
            _context.Add(_simGroup2 = Utils.CreateSimGroup(organization: _org2, name: "simGroup2", isolatedNw1IpPool: "Nw1IpAddressPool"));
            _context.Add(_sim1      = new Sim() // 組織 : '自組織
            {
                Msisdn   = "1001",
                Imsi     = "1001",
                IccId    = "1001",
                UserName = "******",
                Password = "******",
                SimGroup = _simGroup1
            });
            _context.Add(_sim2 = new Sim() // 組織 : '他組織
            {
                Msisdn   = "1002",
                Imsi     = "1002",
                IccId    = "1002",
                UserName = "******",
                Password = "******",
                SimGroup = _simGroup2
            });
            _context.Add(_simAndDevice1 = Utils.CreateSimAndDevice(sim: _sim1, device: _device1, startDate: DateTime.Parse("2020-02-01"), endDate: DateTime.Parse("2021-02-01")));
            _context.Add(_simAndDevice2 = Utils.CreateSimAndDevice(sim: _sim2, device: _device1)); // sim 他組織
            _context.Add(_simAndDevice3 = Utils.CreateSimAndDevice(sim: _sim1, device: _device2)); // 端末 他組織
            _context.SaveChanges();
        }
예제 #11
0
        public CsvImportMineTests(CustomWebApplicationFactoryWithMariaDb <JinCreek.Server.Admin.Startup> factory)
        {
            _client  = factory.CreateClient();
            _context = factory.Services.GetService <IServiceScopeFactory>().CreateScope().ServiceProvider.GetService <MainDbContext>();

            //_context.Database.EnsureDeleted();
            //_context.Database.EnsureCreated();
            //_context.Database.Migrate();
            Utils.RemoveAllEntities(_context);

            _context.Add(_org1    = Utils.CreateOrganization(code: 1, name: "org1"));
            _context.Add(_org2    = Utils.CreateOrganization(code: 2, name: "org2"));
            _context.Add(_domain1 = new Domain {
                Id = Guid.NewGuid(), Name = "domain01", Organization = _org1
            });
            _context.Add(_domain2 = new Domain {
                Id = Guid.NewGuid(), Name = "domain03", Organization = _org2
            });
            _context.Add(_userGroup1 = new UserGroup {
                AdObjectId = Guid.NewGuid(), Id = Guid.NewGuid(), Name = "userGroup1", Domain = _domain1
            });
            _context.Add(_userGroup2 = new UserGroup {
                AdObjectId = Guid.NewGuid(), Id = Guid.NewGuid(), Name = "userGroup2", Domain = _domain2
            });
            _context.Add(new SuperAdmin {
                Name = "", AccountName = "user0", Password = Utils.HashPassword("user0")
            });                                                                                                        // スーパー管理者
            _context.Add(new UserAdmin {
                AdObjectId = Guid.NewGuid(), Name = "", AccountName = "user1", Password = Utils.HashPassword("user1"), Domain = _domain1
            });                                                                                                                                                       // ユーザー管理者
            _context.Add(_simGroup1 = new SimGroup()
            {
                Id                      = Guid.NewGuid(),
                Name                    = "simGroup1",
                Organization            = _org1,
                Apn                     = "apn",
                AuthenticationServerIp  = "AuthenticationServerIp",
                IsolatedNw1IpPool       = "IsolatedNw1IpPool1",
                IsolatedNw1SecondaryDns = "IsolatedNw1SecondaryDns",
                IsolatedNw1IpRange      = "IsolatedNw1IpRange",
                IsolatedNw1PrimaryDns   = "IsolatedNw1PrimaryDns",
                NasIp                   = "NasIp",
                PrimaryDns              = "PrimaryDns",
                SecondaryDns            = "SecondaryDns",
                UserNameSuffix          = "UserNameSuffix"
            });
            _context.Add(_simGroup1a = new SimGroup
            {
                Id                      = Guid.NewGuid(),
                Name                    = "simGroup1a",
                Organization            = _org1,
                Apn                     = "apn",
                AuthenticationServerIp  = "AuthenticationServerIp",
                IsolatedNw1IpPool       = "IsolatedNw1IpPool1a",
                IsolatedNw1SecondaryDns = "IsolatedNw1SecondaryDns",
                IsolatedNw1IpRange      = "IsolatedNw1IpRange",
                IsolatedNw1PrimaryDns   = "IsolatedNw1PrimaryDns",
                NasIp                   = "NasIp",
                PrimaryDns              = "PrimaryDns",
                SecondaryDns            = "SecondaryDns",
                UserNameSuffix          = "UserNameSuffix"
            });
            _context.Add(_simGroup2 = new SimGroup
            {
                Id                      = Guid.NewGuid(),
                Name                    = "simGroup2",
                Organization            = _org2,
                Apn                     = "apn",
                AuthenticationServerIp  = "AuthenticationServerIp",
                IsolatedNw1IpPool       = "IsolatedNw1IpPool2",
                IsolatedNw1SecondaryDns = "IsolatedNw1SecondaryDns",
                IsolatedNw1IpRange      = "IsolatedNw1IpRange",
                IsolatedNw1PrimaryDns   = "IsolatedNw1PrimaryDns",
                NasIp                   = "NasIp",
                PrimaryDns              = "PrimaryDns",
                SecondaryDns            = "SecondaryDns",
                UserNameSuffix          = "UserNameSuffix",
            });
            _context.Add(_device1 = new Device()
            {
                Domain        = _domain1,
                Name          = "device01",
                UseTpm        = true,
                ManagedNumber = "001",
                ProductName   = "",
                SerialNumber  = "",
                WindowsSignInListCacheDays = 1,
            });
            _context.SaveChanges();
        }
예제 #12
0
        public RegisterTests(CustomWebApplicationFactoryWithMariaDb <Startup> factory)
        {
            _client  = factory.CreateClient();
            _context = factory.Services.GetService <IServiceScopeFactory>().CreateScope().ServiceProvider.GetService <MainDbContext>();
            Utils.RemoveAllEntities(_context);

            _context.Add(_org1    = Utils.CreateOrganization(code: 1, name: "org1", startDate: DateTime.Parse("2020-01-14"), endDate: DateTime.Parse("2021-01-30")));
            _context.Add(_domain1 = new Domain {
                Id = Guid.NewGuid(), Name = "domain01", Organization = _org1
            });
            _context.Add(_userGroup1 = new UserGroup {
                Id = Guid.NewGuid(), Domain = _domain1, Name = "userGroup1"
            });
            _context.Add(_user1 = new SuperAdmin {
                AccountName = "user0", Name = "user0", Password = Utils.HashPassword("user0")
            });                                                                                                                      // スーパー管理者
            _context.Add(_user2 = new UserAdmin {
                AccountName = "user1", Name = "user1", Password = Utils.HashPassword("user1"), Domain = _domain1
            });                                                                                                                                        // ユーザー管理者
            _context.Add(_user3 = new GeneralUser {
                AccountName = "user2", Name = "user2", DomainId = _domain1.Id
            });
            _context.Add(new UserGroupEndUser()
            {
                EndUser = _user2, UserGroup = _userGroup1
            });
            _context.Add(new AvailablePeriod {
                EndUser = _user2, EndDate = DateTime.Parse("2021-03-01"), StartDate = DateTime.Parse("2020-02-10")
            });
            _context.Add(new AvailablePeriod {
                EndUser = _user3, EndDate = DateTime.Parse("2021-03-01"), StartDate = DateTime.Parse("2020-02-10")
            });
            _context.Add(_deviceGroup1 = new DeviceGroup {
                Id = Guid.NewGuid(), Name = "_deviceGroup1", Domain = _domain1
            });
            _context.Add(_lteModule1 = new LteModule {
                Name = "lte1", UseSoftwareRadioState = true, NwAdapterName = "abc"
            });
            _context.Add(_device1 = new Device()
            {
                LteModule     = _lteModule1,
                Domain        = _domain1,
                Name          = "device01",
                UseTpm        = true,
                ManagedNumber = "001",
                WindowsSignInListCacheDays = 1,
            });
            _context.Add(_simGroup1 = new SimGroup()
            {
                Id                      = Guid.NewGuid(),
                Name                    = "simGroup1",
                Organization            = _org1,
                Apn                     = "apn",
                AuthenticationServerIp  = "AuthServerIpAddress",
                IsolatedNw1IpPool       = "Nw1IpAddressPool",
                IsolatedNw1SecondaryDns = "Nw1SecondaryDns",
                IsolatedNw1IpRange      = "Nw1IpAddressRange",
                IsolatedNw1PrimaryDns   = "Nw1PrimaryDns",
                NasIp                   = "NasIpAddress",
                UserNameSuffix          = "UserNameSuffix",
                PrimaryDns              = "PrimaryDns",
                SecondaryDns            = "SecondaryDns"
            });
            _context.Add(_sim1 = new Sim() // 組織 : '自組織
            {
                Msisdn   = "1001",
                Imsi     = "1001",
                IccId    = "1001",
                UserName = "******",
                Password = "******",
                SimGroup = _simGroup1
            });
            _context.Add(_sim2 = new Sim() // 組織 : '自組織
            {
                Msisdn   = "1002",
                Imsi     = "1002",
                IccId    = "1002",
                UserName = "******",
                Password = "******",
                SimGroup = _simGroup1
            });
            _context.Add(_simAndDevice1 = new SimAndDevice()
            {
                Sim                    = _sim1,
                Device                 = _device1,
                IsolatedNw2Ip          = "127.0.0.1/18",
                AuthenticationDuration = 1,
                StartDate              = DateTime.Parse("2020-02-01"),
                EndDate                = DateTime.Parse("2021-02-01")
            });
            _context.SaveChanges();
        }
예제 #13
0
        public DeleteMineTests(CustomWebApplicationFactoryWithMariaDb <Admin.Startup> factory)
        {
            _client  = factory.CreateClient();
            _context = factory.Services.GetService <IServiceScopeFactory>().CreateScope().ServiceProvider.GetService <MainDbContext>();
            Utils.RemoveAllEntities(_context);

            _context.Add(_org1    = Utils.CreateOrganization(code: 1, name: "org1"));
            _context.Add(_org2    = Utils.CreateOrganization(code: 2, name: "org2"));
            _context.Add(_domain1 = new Domain {
                Id = Guid.NewGuid(), Name = "domain01", Organization = _org1
            });
            _context.Add(_domain2 = new Domain {
                Id = Guid.NewGuid(), Name = "domain02", Organization = _org2
            });
            _context.Add(_userGroup1 = new UserGroup {
                Id = Guid.NewGuid(), Name = "userGroup1", Domain = _domain1
            });
            _context.Add(_userGroup2 = new UserGroup {
                Id = Guid.NewGuid(), Name = "userGroup2", Domain = _domain2
            });

            _context.Add(_user1 = new SuperAdmin {
                AccountName = "user0", Name = "user0", Password = Utils.HashPassword("user0")
            });                                                                                                                      // スーパー管理者
            _context.Add(_user2 = new UserAdmin {
                AccountName = "user1", Name = "user1", Password = Utils.HashPassword("user1"), Domain = _domain1
            });                                                                                                                                        // ユーザー管理者
            _context.Add(_user3 = new GeneralUser {
                AccountName = "user2", Name = "user2", DomainId = _domain1.Id
            });
            _context.Add(_user4 = new GeneralUser {
                AccountName = "user4", Name = "user4", DomainId = _domain2.Id
            });

            _context.Add(_simGroup1 = Utils.CreateSimGroup(name: "simGroup1", organization: _org1, isolatedNw1IpPool: "IsolatedNw1IpPool"));
            _context.Add(_simGroup2 = Utils.CreateSimGroup(name: "simGroup2", organization: _org2, isolatedNw1IpPool: "IsolatedNw1IpPool"));
            _context.Add(_sim1      = new Sim() // 組織 : '自組織
            {
                Msisdn   = "msisdn01",
                Imsi     = "imsi01",
                IccId    = "iccid01",
                UserName = "******",
                Password = "******",
                SimGroup = _simGroup1
            });
            _context.Add(_sim2 = new Sim() // 組織 : '他組織
            {
                Msisdn   = "1002",
                Imsi     = "1002",
                IccId    = "1002",
                UserName = "******",
                Password = "******",
                SimGroup = _simGroup2
            });
            _context.Add(_device1 = new Device()
            {
                LteModule     = null,
                Domain        = _domain1,
                Name          = "device01",
                UseTpm        = true,
                ManagedNumber = "001",
                WindowsSignInListCacheDays = 1,
            });
            _context.Add(_simDevice1 = new SimAndDevice()
            {
                Sim                    = _sim1,
                Device                 = _device1,
                IsolatedNw2Ip          = "127.0.0.1/18",
                AuthenticationDuration = 1,
                StartDate              = DateTime.Parse("2020-02-01"),
                EndDate                = DateTime.Parse("2020-02-09")
            });
            _context.Add(_multiFactor1 = new MultiFactor
            {
                SimAndDeviceId = _simDevice1.Id,
                EndUserId      = _user3.Id,
                ClosedNwIp     = "127.0.0.1",
                StartDate      = DateTime.Now,
                EndDate        = DateTime.Now
            });
            _context.Add(_multiFactor2 = new MultiFactor // 他組織
            {
                SimAndDeviceId = _simDevice1.Id,
                EndUserId      = _user4.Id,
                ClosedNwIp     = "127.0.0.1",
                StartDate      = DateTime.Now,
                EndDate        = DateTime.Now
            });
            _context.SaveChanges();
        }
예제 #14
0
        public InquiryTests(CustomWebApplicationFactoryWithMariaDb <JinCreek.Server.Admin.Startup> factory)
        {
            _client  = factory.CreateClient();
            _context = factory.Services.GetService <IServiceScopeFactory>().CreateScope().ServiceProvider.GetService <MainDbContext>();

            Utils.RemoveAllEntities(_context);

            _context.Add(_org1    = Utils.CreateOrganization(code: 1, name: "org1"));
            _context.Add(_org2    = Utils.CreateOrganization(code: 2, name: "org2"));
            _context.Add(_domain1 = new Domain {
                Id = Guid.NewGuid(), Name = "domain01", OrganizationCode = _org1.Code
            });
            _context.Add(_domain2 = new Domain {
                Id = Guid.NewGuid(), Name = "domain02", OrganizationCode = _org2.Code
            });
            _context.Add(_userGroup1 = new UserGroup {
                Id = Guid.NewGuid(), Name = "userGroup1", DomainId = _domain1.Id
            });
            _context.Add(_userGroup2 = new UserGroup {
                Id = Guid.NewGuid(), Name = "userGroup2", DomainId = _domain2.Id
            });
            _context.Add(_user0 = new SuperAdmin {
                Name = "", AccountName = "user0", Password = Utils.HashPassword("user0")
            });                                                                                                                 // スーパー管理者
            _context.Add(_user1 = new UserAdmin()
            {
                Name = "", AccountName = "user1", Password = Utils.HashPassword("user1"), Domain = _domain1
            });                                                                                                                                     // ユーザー管理者
            _context.Add(_user2 = new GeneralUser()
            {
                Name = "", AccountName = "user2", DomainId = _domain1.Id
            });
            _context.Add(_user3 = new GeneralUser()
            {
                Name = "", AccountName = "user3", DomainId = _domain1.Id
            });
            _context.Add(_user4 = new GeneralUser()
            {
                Name = "", AccountName = "user4", DomainId = _domain2.Id
            });
            _context.Add(new AvailablePeriod()
            {
                EndUser = _user1, EndDate = DateTime.Parse("2021-03-01"), StartDate = DateTime.Parse("2020-02-10")
            });
            _context.Add(new AvailablePeriod()
            {
                EndUser = _user2, EndDate = DateTime.Parse("2021-03-01"), StartDate = DateTime.Parse("2020-02-10")
            });
            _context.Add(new AvailablePeriod()
            {
                EndUser = _user3, EndDate = DateTime.Parse("2021-03-01"), StartDate = DateTime.Parse("2020-02-10")
            });
            _context.Add(new AvailablePeriod()
            {
                EndUser = _user4, EndDate = DateTime.Parse("2021-03-01"), StartDate = DateTime.Parse("2020-02-10")
            });
            _context.Add(_userGroupEndUser = new UserGroupEndUser()
            {
                EndUser = _user2, UserGroup = _userGroup1
            });
            _context.Add(_simGroup1 = new SimGroup
            {
                Name                    = "simGroup1",
                Organization            = _org1,
                Apn                     = "apn",
                AuthenticationServerIp  = "AuthServerIpAddress",
                IsolatedNw1IpPool       = "Nw1IpAddressPool",
                IsolatedNw1SecondaryDns = "Nw1SecondaryDns",
                IsolatedNw1IpRange      = "Nw1IpAddressRange",
                IsolatedNw1PrimaryDns   = "Nw1PrimaryDns",
                NasIp                   = "NasIpAddress",
                UserNameSuffix          = "UserNameSuffix",
                PrimaryDns              = "PrimaryDns",
                SecondaryDns            = "SecondaryDns"
            });
            _context.Add(_sim1 = new Sim {
                SimGroup = _simGroup1, Msisdn = "msisdn01", Imsi = "imsi01", IccId = "iccid01", UserName = "******", Password = "******"
            });
            _context.Add(_sim2 = new Sim {
                SimGroup = _simGroup1, Msisdn = "msisdn02", Imsi = "imsi02", IccId = "iccid02", UserName = "******", Password = "******"
            });
            _context.Add(_deviceGroup1 = new DeviceGroup {
                DomainId = _domain1.Id, Name = "deviceGroup1"
            });
            _context.Add(_device1 = new Device
            {
                LteModule     = _lte1,
                Domain        = _domain1,
                Name          = "device01",
                UseTpm        = true,
                ManagedNumber = "001",
                ProductName   = "",
                SerialNumber  = "",
                WindowsSignInListCacheDays = 1,
                StartDate = DateTime.Parse("2020-02-07"),
                EndDate   = DateTime.Parse("2021-02-01")
            });
            _context.Add(_device2 = new Device
            {
                LteModule     = _lte1,
                Domain        = _domain1,
                Name          = "device02",
                UseTpm        = true,
                ManagedNumber = "002",
                ProductName   = "",
                SerialNumber  = "",
                WindowsSignInListCacheDays = 1,
                StartDate = DateTime.Parse("2020-02-07"),
                EndDate   = DateTime.Parse("2021-02-01")
            });
            _context.Add(_device3 = new Device
            {
                LteModule     = _lte1,
                Domain        = _domain2,
                Name          = "device02",
                UseTpm        = true,
                ManagedNumber = "002",
                ProductName   = "",
                SerialNumber  = "",
                WindowsSignInListCacheDays = 1,
                StartDate = DateTime.Parse("2020-02-07"),
                EndDate   = DateTime.Parse("2021-02-01")
            });
            _context.Add(_simDevice1 = new SimAndDevice
            {
                SimId                  = _sim1.Id,
                DeviceId               = _device1.Id,
                IsolatedNw2Ip          = "127.0.0.1",
                AuthenticationDuration = 1,
                StartDate              = DateTime.Parse("2020-02-07"),
                EndDate                = DateTime.Parse("2020-03-07"),
            });
            _context.Add(_simDevice2 = new SimAndDevice
            {
                SimId                  = _sim2.Id,
                DeviceId               = _device1.Id,
                IsolatedNw2Ip          = "127.0.0.1",
                AuthenticationDuration = 1,
                StartDate              = DateTime.Parse("2020-02-07"),
                EndDate                = DateTime.Parse("2020-03-07"),
            });
            _context.Add(_simDevice3 = new SimAndDevice
            {
                SimId                  = _sim1.Id,
                DeviceId               = _device2.Id,
                IsolatedNw2Ip          = "127.0.0.1",
                AuthenticationDuration = 1,
                StartDate              = DateTime.Parse("2020-02-07"),
                EndDate                = DateTime.Parse("2020-03-07"),
            });
            _context.Add(_simDevice4 = new SimAndDevice
            {
                SimId                  = _sim2.Id,
                DeviceId               = _device2.Id,
                IsolatedNw2Ip          = "127.0.0.1",
                AuthenticationDuration = 1,
                StartDate              = DateTime.Parse("2020-02-07"),
                EndDate                = DateTime.Parse("2020-03-07"),
            });
            _context.Add(_multiFactor1 = new MultiFactor
            {
                Id             = Guid.NewGuid(),
                SimAndDeviceId = _simDevice1.Id,
                EndUserId      = _user2.Id,
                ClosedNwIp     = "127.0.0.1",
                StartDate      = DateTime.Parse("2020-02-01"),
            });
            _context.Add(_multiFactor2 = new MultiFactor
            {
                Id             = Guid.NewGuid(),
                SimAndDeviceId = _simDevice2.Id,
                EndUserId      = _user2.Id,
                ClosedNwIp     = "127.0.0.1",
                StartDate      = DateTime.Parse("2020-02-01"),
            });
            _context.Add(_multiFactor3 = new MultiFactor
            {
                Id             = Guid.NewGuid(),
                SimAndDeviceId = _simDevice3.Id,
                EndUserId      = _user2.Id,
                ClosedNwIp     = "127.0.0.1",
                StartDate      = DateTime.Parse("2020-02-01"),
            });
            _context.Add(_multiFactor4 = new MultiFactor
            {
                Id             = Guid.NewGuid(),
                SimAndDeviceId = _simDevice4.Id,
                EndUserId      = _user2.Id,
                ClosedNwIp     = "127.0.0.1",
                StartDate      = DateTime.Parse("2020-02-01"),
            });
            _context.Add(_multiFactor5 = new MultiFactor
            {
                Id             = Guid.NewGuid(),
                SimAndDeviceId = _simDevice1.Id,
                EndUserId      = _user3.Id,
                ClosedNwIp     = "127.0.0.1",
                StartDate      = DateTime.Parse("2020-02-01"),
            });
            _context.Add(_multiFactor6 = new MultiFactor
            {
                Id             = Guid.NewGuid(),
                SimAndDeviceId = _simDevice2.Id,
                EndUserId      = _user3.Id,
                ClosedNwIp     = "127.0.0.1",
                StartDate      = DateTime.Parse("2020-02-01"),
            });
            _context.Add(_multiFactor7 = new MultiFactor
            {
                Id             = Guid.NewGuid(),
                SimAndDeviceId = _simDevice3.Id,
                EndUserId      = _user3.Id,
                ClosedNwIp     = "127.0.0.1",
                StartDate      = DateTime.Parse("2020-02-01"),
            });
            _context.Add(_multiFactor8 = new MultiFactor
            {
                Id             = Guid.NewGuid(),
                SimAndDeviceId = _simDevice4.Id,
                EndUserId      = _user3.Id,
                ClosedNwIp     = "127.0.0.1",
                StartDate      = DateTime.Parse("2020-02-01"),
            });
            _context.Add(_multiFactor9 = new MultiFactor
            {
                Id             = Guid.NewGuid(),
                SimAndDeviceId = _simDevice1.Id,
                EndUserId      = _user4.Id,
                ClosedNwIp     = "127.0.0.1",
                StartDate      = DateTime.Parse("2020-02-01"),
            });
            _context.Add(_multiFactor10 = new MultiFactor
            {
                Id             = Guid.NewGuid(),
                SimAndDeviceId = _simDevice2.Id,
                EndUserId      = _user4.Id,
                ClosedNwIp     = "127.0.0.1",
                StartDate      = DateTime.Parse("2020-02-01"),
            });
            _context.Add(_multiFactor11 = new MultiFactor
            {
                Id             = Guid.NewGuid(),
                SimAndDeviceId = _simDevice3.Id,
                EndUserId      = _user4.Id,
                ClosedNwIp     = "127.0.0.1",
                StartDate      = DateTime.Parse("2020-02-01"),
            });
            _context.Add(_multiFactor12 = new MultiFactor
            {
                Id             = Guid.NewGuid(),
                SimAndDeviceId = _simDevice4.Id,
                EndUserId      = _user4.Id,
                ClosedNwIp     = "127.0.0.1",
                StartDate      = DateTime.Parse("2020-02-01"),
            });
            _context.Add(new MultiFactorAuthenticated()
            {
                Expiration = DateTime.Now.AddHours(1.00), MultiFactor = _multiFactor1
            });
            _context.Add(new MultiFactorAuthenticated()
            {
                Expiration = DateTime.Now.AddHours(1.00), MultiFactor = _multiFactor2
            });
            _context.Add(new MultiFactorAuthenticated()
            {
                Expiration = DateTime.Now.AddHours(1.00), MultiFactor = _multiFactor3
            });
            _context.Add(new MultiFactorAuthenticated()
            {
                Expiration = DateTime.Now.AddHours(1.00), MultiFactor = _multiFactor4
            });
            _context.Add(new MultiFactorAuthenticated()
            {
                Expiration = DateTime.Now.AddHours(1.00), MultiFactor = _multiFactor5
            });
            _context.Add(new MultiFactorAuthenticated()
            {
                Expiration = DateTime.Now.AddHours(1.00), MultiFactor = _multiFactor6
            });
            _context.Add(new MultiFactorAuthenticated()
            {
                Expiration = DateTime.Now.AddHours(1.00), MultiFactor = _multiFactor7
            });
            _context.Add(new MultiFactorAuthenticated()
            {
                Expiration = DateTime.Now.AddHours(1.00), MultiFactor = _multiFactor8
            });
            _context.Add(new MultiFactorAuthenticated()
            {
                Expiration = DateTime.Now.AddHours(1.00), MultiFactor = _multiFactor9
            });
            _context.Add(new MultiFactorAuthenticated()
            {
                Expiration = DateTime.Now.AddHours(1.00), MultiFactor = _multiFactor10
            });
            _context.Add(new MultiFactorAuthenticated()
            {
                Expiration = DateTime.Now.AddHours(1.00), MultiFactor = _multiFactor11
            });
            _context.Add(new MultiFactorAuthenticated()
            {
                Expiration = DateTime.Now.AddHours(1.00), MultiFactor = _multiFactor12
            });
            _context.SaveChanges();
        }