Exemple #1
0
        public InquiryTests(CustomWebApplicationFactory <JinCreek.Server.Admin.Startup> factory)
        {
            _client  = factory.CreateClient();
            _context = factory.Services.GetService <IServiceScopeFactory>().CreateScope().ServiceProvider.GetService <MainDbContext>();

            _context.Database.EnsureDeleted();
            _context.Database.EnsureCreated();


            _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(_org1    = Utils.CreateOrganization(code: 1, name: "org1"));
            _context.Add(_domain1 = new Domain {
                Id = Guid.NewGuid(), Name = "domain1", Organization = _org1
            });
            _context.Add(_deviceGroup1 = new DeviceGroup {
                Id = Guid.NewGuid(), Domain = _domain1, Name = "deviceGroup1"
            });
            _context.Add(_userGroup1 = new UserGroup {
                Id = Guid.NewGuid(), Domain = _domain1, Name = "userGroup1"
            });
            _context.Add(_lte1 = new LteModule {
                Id = Guid.NewGuid(), Name = "lte1"
            });
            _context.Add(_device1 = new Device
            {
                Id                 = Guid.NewGuid(),
                Name               = "deviceName1",
                Domain             = _domain1,
                ManagedNumber      = "0001",
                SerialNumber       = "0001",
                ProductName        = "Test1",
                UseTpm             = true,
                StartDate          = DateTime.Parse("2020-02-01"),
                EndDate            = DateTime.Parse("2021-03-01"),
                LteModule          = _lte1,
                DeviceGroupDevices = new HashSet <DeviceGroupDevice> {
                    new DeviceGroupDevice {
                        DeviceGroup = _deviceGroup1
                    }
                },
                WindowsSignInListCacheDays = 1,
                OrganizationClientApp      = _organizationClientApp1,
            });
            _context.Add(_user0 = new SuperAdmin {
                AccountName = "user0", Password = Utils.HashPassword("user0")
            });                                                                                                      // スーパー管理者;
            _context.Add(_user1 = new UserAdmin {
                AccountName = "user1", Password = Utils.HashPassword("user1"), Domain = _domain1
            });                                                                                                                        // ユーザー管理者1
            _context.SaveChanges();
        }
Exemple #2
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();
        }
Exemple #3
0
        public ListingMineTests(CustomWebApplicationFactory <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(_domain1a = new Domain {
                Id = Guid.NewGuid(), Name = "domain01a", Organization = _org1
            });
            _context.Add(_domain2 = new Domain {
                Id = Guid.NewGuid(), Name = "domain02", Organization = _org2
            });
            _context.Add(_user1 = new SuperAdmin {
                AccountName = "user0", Password = Utils.HashPassword("user0")
            });                                                                                                      // スーパー管理者
            _context.Add(_user2 = new UserAdmin {
                AccountName = "user1", Password = Utils.HashPassword("user1"), Domain = _domain1
            });                                                                                                                        // ユーザー管理者
            _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(_deviceGroup1a = new DeviceGroup
            {
                Id = Guid.NewGuid(), Name = "_deviceGroup1a", Domain = _domain1a
            });
            _context.Add(_lte1 = new LteModule {
                Name = "lte1", UseSoftwareRadioState = true, NwAdapterName = "abc"
            });
            _context.Add(_lte2 = new LteModule {
                Name = "lte2", UseSoftwareRadioState = true, NwAdapterName = "abc"
            });
            _context.SaveChanges();
        }
        private void CreateDeviceRecords()
        {
            var lteModule = new LteModule()
            {
                Name                  = "Lte",
                NwAdapterName         = "Adapter",
                UseSoftwareRadioState = true
            };

            var deviceGroup = new DeviceGroup()
            {
                Domain     = Domain,
                Name       = "DeviceGroup",
                AdObjectId = Guid.NewGuid()
            };

            Device1 = new Device()
            {
                Domain    = Domain,
                Name      = "Device1",
                LteModule = lteModule,
                UseTpm    = true,
                WindowsSignInListCacheDays = 1,
                StartDate  = CurrentDateTimeForStart.Item1,
                EndDate    = CurrentDateTimeForStart.Item2,
                AdObjectId = Guid.NewGuid()
            };

            var deviceGroupDevice = new DeviceGroupDevice()
            {
                DeviceGroup = deviceGroup,
                Device      = Device1
            };

            MainDbContext.AddRange(lteModule, deviceGroup, Device1, deviceGroupDevice);
        }
        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();
        }
        public ListingTests(CustomWebApplicationFactory <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(_user1 = new SuperAdmin {
                AccountName = "user0", Password = Utils.HashPassword("user0")
            });                                                                                                      // スーパー管理者
            _context.Add(_user2 = new UserAdmin()
            {
                AccountName = "user1", Password = Utils.HashPassword("user1"), Domain = _domain1
            });                                                                                                                          // ユーザー管理者
            _context.Add(_user3 = new GeneralUser()
            {
                AccountName = "user3", DomainId = _domain1.Id
            });
            _context.Add(_user3a = new GeneralUser()
            {
                AccountName = "user3a", DomainId = _domain1.Id
            });
            _context.Add(_user4 = new GeneralUser()
            {
                AccountName = "user4", DomainId = _domain2.Id
            });
            _context.Add(_deviceGroup1 = new DeviceGroup()
            {
                Id = Guid.NewGuid(), Name = "_deviceGroup1", Domain = _domain1
            });
            _context.Add(_lte1 = new LteModule()
            {
                Name = "lte1", UseSoftwareRadioState = true, NwAdapterName = "abc"
            });
            _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(_simGroup2 = new SimGroup
            {
                Id = Guid.NewGuid(), Name = "simGroup2", Organization = _org2, IsolatedNw1IpPool = ""
            });
            _context.Add(_sim1 = new Sim() // 組織 : '自組織
            {
                Msisdn   = "msisdn01",
                Imsi     = "imsi01",
                IccId    = "iccid01",
                UserName = "******",
                Password = "******",
                SimGroup = _simGroup1
            });
            _context.Add(_sim1a = new Sim() // 組織 : '自組織
            {
                Msisdn   = "msisdn01a",
                Imsi     = "imsi01a",
                IccId    = "iccid01a",
                UserName = "******",
                Password = "******",
                SimGroup = _simGroup1
            });
            _context.Add(_sim2 = new Sim() // 組織 : '他組織
            {
                Msisdn   = "msisdn02",
                Imsi     = "imsi02",
                IccId    = "iccid02",
                UserName = "******",
                Password = "******",
                SimGroup = _simGroup2
            });
            _context.Add(_device1 = new Device()
            {
                LteModule     = _lte1,
                Domain        = _domain1,
                Name          = "device01",
                UseTpm        = true,
                ManagedNumber = "001",
                WindowsSignInListCacheDays = 1,
            });
            _context.Add(_device1a = new Device()
            {
                LteModule     = _lte1,
                Domain        = _domain1,
                Name          = "device01a",
                UseTpm        = true,
                ManagedNumber = "001",
                WindowsSignInListCacheDays = 1,
            });
            _context.Add(_device2 = new Device()// 端末 他組織
            {
                LteModule     = _lte1,
                Domain        = _domain2,
                Name          = "device02",
                UseTpm        = true,
                ManagedNumber = "001",
                WindowsSignInListCacheDays = 1,
            });
            _context.Add(_simDevice1 = new SimAndDevice {
                SimId = _sim1.Id, DeviceId = _device1.Id
            });
            _context.Add(_simDevice1a = new SimAndDevice {
                SimId = _sim1a.Id, DeviceId = _device1.Id
            });
            _context.Add(_simDevice1b = new SimAndDevice {
                SimId = _sim1a.Id, DeviceId = _device1a.Id
            });
            _context.Add(_simDevice2 = new SimAndDevice {
                SimId = _sim2.Id, DeviceId = _device1.Id
            });                                                                                        // sim 他組織
            _context.Add(_simDevice3 = new SimAndDevice {
                SimId = _sim1.Id, DeviceId = _device2.Id
            });                                                                                        // 端末 他組織
            _context.SaveChanges();
        }
        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();
        }
        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();
        }
Exemple #9
0
        public UpdateMineTests(CustomWebApplicationFactory <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(_lte1 = new LteModule()
            {
                Name = "lte1", UseSoftwareRadioState = true, NwAdapterName = "abc"
            });
            _context.Add(_user1 = new SuperAdmin {
                AccountName = "user0", Password = Utils.HashPassword("user0")
            });                                                                                                      // スーパー管理者
            _context.Add(_user2 = new UserAdmin {
                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"
            });
            _context.Add(_simGroup2 = new SimGroup
            {
                Id = Guid.NewGuid(), Name = "simGroup2", Organization = _org2, 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     = _lte1,
                Domain        = _domain1,
                Name          = "device01",
                UseTpm        = true,
                ManagedNumber = "001",
                WindowsSignInListCacheDays = 1,
                StartDate = DateTime.Parse("2020-01-30"),
                EndDate   = DateTime.Parse("2021-02-01")
            });
            _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.SaveChanges();
        }
        public CsvExportTests(CustomWebApplicationFactory <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(_domain1a = new Domain {
                Id = Guid.NewGuid(), Name = "domain02", Organization = _org1
            });
            _context.Add(_domain2 = new Domain {
                Id = Guid.NewGuid(), Name = "domain03", 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 {
                Id = Guid.NewGuid(), Name = "device1", ManagedNumber = "1", Domain = _domain1, DeviceGroupDevices = new HashSet <DeviceGroupDevice> {
                    new DeviceGroupDevice {
                        DeviceGroup = _deviceGroup1
                    }
                }
            });
            _context.Add(_device1B = new Device {
                Id = Guid.NewGuid(), Name = "device1b", ManagedNumber = "2", Domain = _domain1, DeviceGroupDevices = new HashSet <DeviceGroupDevice> {
                    new DeviceGroupDevice {
                        DeviceGroup = _deviceGroup1
                    }
                }
            });
            _context.Add(_device1C = new Device {
                Id = Guid.NewGuid(), Name = "device1c", ManagedNumber = "2", Domain = _domain1a, DeviceGroupDevices = new HashSet <DeviceGroupDevice> {
                    new DeviceGroupDevice {
                        DeviceGroup = _deviceGroup1
                    }
                }, StartDate = DateTime.MinValue, EndDate = DateTime.MaxValue
            });
            _context.Add(_device2 = new Device {
                Id = Guid.NewGuid(), Name = "device2", ManagedNumber = "1", Domain = _domain2, DeviceGroupDevices = new HashSet <DeviceGroupDevice> {
                    new DeviceGroupDevice {
                        DeviceGroup = _deviceGroup2
                    }
                }
            });
            _context.Add(_lte1 = new LteModule {
                Id = Guid.NewGuid(), Name = "lte1"
            });
            _context.Add(new SuperAdmin {
                AccountName = "user0", Password = Utils.HashPassword("user0")
            });                                                                                             // スーパー管理者
            _context.Add(new UserAdmin {
                AccountName = "user1", Password = Utils.HashPassword("user1"), Domain = _domain1
            });                                                                                                               // ユーザー管理者
            _context.SaveChanges();
        }