Exemple #1
0
        public void Case06()
        {
            var organization = Utils.CreateOrganization(code: 5, name: "org5");
            var simGroup     = new SimGroup
            {
                Id                      = Guid.NewGuid(),
                Name                    = "simGroup1",
                Organization            = organization,
                Apn                     = "apn",
                AuthenticationServerIp  = "AuthenticationServerIp",
                IsolatedNw1IpPool       = "IsolatedNw1IpPool",
                IsolatedNw1SecondaryDns = "IsolatedNw1SecondaryDns",
                IsolatedNw1IpRange      = "IsolatedNw1IpRange",
                IsolatedNw1PrimaryDns   = "IsolatedNw1PrimaryDns",
                NasIp                   = "NasIp",
                PrimaryDns              = "PrimaryDns",
                SecondaryDns            = "SecondaryDns",
                UserNameSuffix          = "",
            };

            _context.AddRange(organization, simGroup);
            _context.SaveChanges();

            var(response, _, json) = Utils.Delete(_client, $"{Url}/5", "user0", "user0");  // スーパー管理者
            Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
            Assert.NotNull(json["traceId"]);
            Assert.NotNull(json["errors"][nameof(SimGroup)]); // 存在
            Assert.Null(json["errors"][nameof(Domain)]);
            Assert.Null(json["errors"][nameof(OrganizationClientApp)]);
        }
        public void Case01()
        {
            GeneralUser user = new GeneralUser
            {
                AccountName = "User03",
                Domain      = _domain,
                Name        = "user03",
                AuthenticateWhenUnlockingScreen = true
            };
            UserGroupEndUser userGroupEndUser = new UserGroupEndUser()
            {
                UserGroup = _userGroup1,
                EndUser   = user
            };

            _context.Add(user);
            _context.AddRange(userGroupEndUser);
            _context.SaveChanges();
            var token = Utils.GetAccessToken(_client, "user1", "user1", 1, "domain"); // ユーザー管理者
            var obj   = new
            {
                AuthenticateWhenUnlockingScreen = false
            };
            var result = Utils.Put(_client, $"{Url}/", Utils.CreateJsonContent(obj), token);
            var body   = result.Content.ReadAsStringAsync().Result;

            Assert.Equal(HttpStatusCode.Forbidden, result.StatusCode);
            Assert.Empty(body);
        }
Exemple #3
0
        public void Case14()
        {
            var sim1 = new Sim()  //自組織
            {
                Msisdn   = "1001",
                Imsi     = "1001",
                IccId    = "1001",
                UserName = "******",
                Password = "******",
                SimGroup = _simGroup1
            };
            var sim2 = new Sim() // 他組織
            {
                Msisdn   = "1002",
                Imsi     = "1002",
                IccId    = "1002",
                UserName = "******",
                Password = "******",
                SimGroup = _simGroup2
            };

            _context.AddRange(sim1, sim2);
            _context.SaveChanges();

            var obj = new StringBuilder();

            obj.AppendLine("is Delete,ID,SIM Group ID,SIM Group Name,MSISDN,IMSI,ICC ID,User Name,Password");
            obj.AppendLine($"a,{sim1.Id},{_simGroup1.Id},{_simGroup1.Name},{sim1.Msisdn},{sim1.Imsi},{sim1.IccId},sim001,123456");
            obj.AppendLine($"a,{sim2.Id},{_simGroup2.Id},{_simGroup2.Name},{sim2.Msisdn},{sim2.Imsi},{sim2.IccId},sim002,123456");                   //DBにSIM:他組織

            var(response, _, json) = Utils.Post(_client, $"{Url}", Utils.CreateFormContent(obj.ToString(), "csv"), "user1", "user1", 1, "domain01"); // ユーザー管理者
            Assert.Equal(HttpStatusCode.Forbidden, response.StatusCode);
            Assert.NotNull(json["traceId"]);
            Assert.NotNull(json["errors"]["Role"]);
        }
        private void SetUpInsertBaseDataForMainDb()
        {
            var organization = new Organization
            {
                Name          = "OrganizationName1",
                Address       = "OrganizationAddress1",
                DelegatePhone = "123465789",
                AdminPhone    = "987654321",
                AdminMail     = "*****@*****.**",
                StartDay      = DateTime.Now,
                EndDay        = DateTime.Now,
                Url           = "Organization1.co.jp",
                IsValid       = true,
            };

            _deviceGroup = new DeviceGroup
            {
                Version      = "1.1",
                Os           = "Window10",
                Organization = organization
            };
            _simGroup = new SimGroup
            {
                SimGroupName        = "SimGroup1",
                Organization        = organization,
                PrimaryDns          = "255.0.0.0",
                SecondaryDns        = "255.0.0.1",
                Apn                 = "SimGroupApn1",
                NasIpAddress        = "NasAddress",
                Nw1IpAddressPool    = "Nw1AddressPool",
                Nw1IpAddressRange   = "Nw1AddressRange",
                AuthServerIpAddress = "127.0.0.1",
                Nw1PrimaryDns       = "255.0.0.0",
                Nw1SecondaryDns     = "255.0.0.0"
            };
            _domain = new Domain
            {
                DomainName   = "Domain1",
                Organization = organization,
            };
            _userGroup = new UserGroup
            {
                Domain        = _domain,
                UserGroupName = "UserGroup1"
            };
            _lte = new Lte
            {
                LteName            = "Lte1",
                NwAdapterName      = "LteAdapter1",
                SoftwareRadioState = true
            };
            _mainDbContext.AddRange(organization, _deviceGroup, _domain, _userGroup, _lte);
            _mainDbContext.SaveChanges();
        }
        private void CreateUserRecords()
        {
            var userGroup = new UserGroup()
            {
                Domain     = Domain,
                Name       = "UserGroup",
                AdObjectId = Guid.NewGuid()
            };

            GeneralUser1 = new GeneralUser()
            {
                AccountName = "GeneralUser1",
                Name        = "GU1",
                Domain      = Domain,
                AuthenticateWhenUnlockingScreen = true,
                AdObjectId = Guid.NewGuid()
            };

            var availablePeriod = new AvailablePeriod()
            {
                EndUser   = GeneralUser1,
                StartDate = CurrentDateTimeForStart.Item1,
                EndDate   = CurrentDateTimeForStart.Item2
            };

            var userGroupEndUser = new UserGroupEndUser()
            {
                UserGroup = userGroup,
                EndUser   = GeneralUser1
            };

            MainDbContext.AddRange(userGroup, GeneralUser1, availablePeriod, userGroupEndUser);
        }
        public void CreateDataCase17()
        {
            CreateBaseData();

            var simAndDeviceAuthenticated = new SimAndDeviceAuthenticated()
            {
                SimAndDevice = SimAndDevice1,
                Expiration   = CurrentDateTimeForLessThanStart.Item2
            };

            MainDbContext.AddRange(simAndDeviceAuthenticated);
            SimAndDevice1.SimAndDeviceAuthenticated = simAndDeviceAuthenticated;

            var multiFactorAuthenticated = new MultiFactorAuthenticated()
            {
                MultiFactor = MultiFactor1,
                Expiration  = CurrentDateTimeForLessThanStart.Item2
            };

            MainDbContext.AddRange(multiFactorAuthenticated);
            MultiFactor1.MultiFactorAuthenticated = multiFactorAuthenticated;

            MainDbContext.SaveChanges();
            RadiusDbContext.SaveChanges();
        }
Exemple #7
0
 public void Set(IEnumerable <KeyValuePair <long, bool> > scenarioIds, long controllerId)
 {
     Remove(controllerId);
     _context.AddRange(scenarioIds.Select(x => new ControllerScenarios()
     {
         ScenarioId   = x.Key,
         TurnedOn     = x.Value,
         ControllerId = controllerId
     }));
 }
        public void Case05()
        {
            var simGroup1 = new SimGroup()
            {
                Id                     = Guid.NewGuid(),
                Name                   = "simGroup01",
                Organization           = _org1,
                Apn                    = "apn01",
                AuthenticationServerIp = "AuthServerIpAddress01",
                NasIp                  = "NasIpAddress01",
            };
            var simGroup2 = new SimGroup()
            {
                Id                     = Guid.NewGuid(),
                Name                   = "simGroup02",
                Organization           = _org1,
                Apn                    = "apn02",
                AuthenticationServerIp = "AuthServerIpAddress02",
                NasIp                  = "NasIpAddress02",
            };
            var simGroup3 = new SimGroup()
            {
                Id                     = Guid.NewGuid(),
                Name                   = "simGroup03",
                Organization           = _org1,
                Apn                    = "apn03",
                AuthenticationServerIp = "AuthServerIpAddress03",
                NasIp                  = "NasIpAddress03",
            };
            var simGroup4 = new SimGroup()
            {
                Id                     = Guid.NewGuid(),
                Name                   = "simGroup04",
                Organization           = _org2,
                Apn                    = "apn04",
                AuthenticationServerIp = "AuthServerIpAddress04",
                NasIp                  = "NasIpAddress04",
            };

            _context.AddRange(simGroup1, simGroup2, simGroup3, simGroup4);
            _context.SaveChanges();

            var(response, body, json) = Utils.Get(_client, $"{Url}/?OrganizationCode={_org1.Code}", "user0", "user0"); // スーパー管理者
            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
            Assert.Equal(3, (int)json["count"]);                                                                       // トータル件数
            Assert.NotEmpty(body);
            var list = (JArray)json["results"];

            Assert.Equal(3, list.Count);
            Assert.Equal("simGroup01", list[0]["name"]);   //SIMグループ名ソート:'昇順
            Assert.Equal("simGroup02", list[1]["name"]);   //SIMグループ名ソート:'昇順
            Assert.Equal("apn02", list[1]["apn"]);         //APNソート:'昇順
            Assert.Equal("apn03", list[2]["apn"]);         //APNソート:'昇順
            Assert.Null(list[0]["traceId"]);
        }
Exemple #9
0
        public void Case04()
        {
            var device1 = new Device
            {
                Name          = "device1",
                ManagedNumber = "1",
                SerialNumber  = "",
                ProductName   = "",
                WindowsSignInListCacheDays = 0,
                Domain             = _domain1,
                DeviceGroupDevices = new HashSet <DeviceGroupDevice> {
                    new DeviceGroupDevice {
                        DeviceGroup = _deviceGroup1
                    }
                },
            };
            var device2 = new Device
            {
                Name          = "device2",
                ManagedNumber = "1",
                SerialNumber  = "",
                ProductName   = "",
                WindowsSignInListCacheDays = 0,
                Domain             = _domain1,
                DeviceGroupDevices = new HashSet <DeviceGroupDevice> {
                    new DeviceGroupDevice {
                        DeviceGroup = _deviceGroup1
                    }
                },
            };

            _context.AddRange(device1, device2);
            _context.SaveChanges();

            var obj = new StringBuilder();

            obj.AppendLine(CsvHeader);
            obj.AppendLine($"{device2.Id},domain1,deviceGroup1,device3,,1001,type01,{_lte1.Id},lte1,{_organizationClientApp1.Id},,,False,0,0001-01-01,");
            obj.AppendLine($"{device1.Id},domain1,deviceGroup1,device1,1,1001,type01,{_lte1.Id},lte1,{_organizationClientApp1.Id},,,False,0,0001-01-01,");

            var(response, _, json) = Utils.Post(_client, $"{Url}", Utils.CreateFormContent(obj.ToString(), "csv"), "user0", "user0"); // スーパー管理者
            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
            Assert.Null(json["traceId"]);                                                                                             // 不在
            Assert.Null(json["errors"]);                                                                                              // 不在
        }
Exemple #10
0
        };                                                                                                                                                         // ユーザー管理者2



        public InquiryMineTests(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.Organization.RemoveRange(_context.Organization);
            //_context.Domain.RemoveRange(_context.Domain);
            //_context.UserGroup.RemoveRange(_context.UserGroup);
            //_context.DeviceGroup.RemoveRange(_context.DeviceGroup);
            //_context.Device.RemoveRange(_context.Device);
            //_context.LteModule.RemoveRange(_context.LteModule);
            //_context.User.RemoveRange(_context.User);
            //_context.SaveChanges();

            _context.AddRange(Org1, Device1, Domain1, UserGroup1, DeviceGroup1, lte1);
            _context.AddRange(Org2, Device2, Domain2, UserGroup2, DeviceGroup2, lte2);
            _context.AddRange(User0, User1, User2);
            _context.SaveChanges();
        }
        private void CreateSimAndDeviceRecords()
        {
            SimAndDevice1 = new SimAndDevice()
            {
                Sim                    = Sim1,
                Device                 = Device1,
                IsolatedNw2Ip          = "192.168.10.1",
                AuthenticationDuration = 2,
                StartDate              = CurrentDateTimeForStart.Item1,
                EndDate                = CurrentDateTimeForStart.Item2,
            };

            MainDbContext.AddRange(SimAndDevice1);
        }
        public SimAndDevice SetUpInsertDataForDeauthenticationCase13()
        {
            var simDevice = new SimAndDevice
            {
                Sim                    = Sim,
                Device                 = Device,
                IsolatedNw2Ip          = "Nw2Address",
                StartDate              = DateTime.Now.AddHours(-6.00),
                EndDate                = DateTime.Now.AddHours(6.00),
                AuthenticationDuration = 1
            };

            MainDbContext.AddRange(simDevice);
            MainDbContext.SaveChanges();
            return(simDevice);
        }
        public void CreateDataCase10()
        {
            CreateBaseData();

            var simAndDeviceAuthenticated = new SimAndDeviceAuthenticated()
            {
                SimAndDevice = SimAndDevice1,
                Expiration   = CurrentDateTimeForEnd.Item2
            };

            MainDbContext.AddRange(simAndDeviceAuthenticated);
            SimAndDevice1.SimAndDeviceAuthenticated = simAndDeviceAuthenticated;

            MainDbContext.SaveChanges();
            RadiusDbContext.SaveChanges();
        }
        public void CreateDataCase04()
        {
            CreateBaseData();

            var multiFactorAuthenticated = new MultiFactorAuthenticated()
            {
                MultiFactor = MultiFactor1,
                Expiration  = CurrentDateTimeForEnd.Item2
            };

            MainDbContext.AddRange(multiFactorAuthenticated);
            MultiFactor1.MultiFactorAuthenticated = multiFactorAuthenticated;

            MainDbContext.SaveChanges();
            RadiusDbContext.SaveChanges();
        }
Exemple #15
0
        public void Case01()
        {
            var org1    = Utils.CreateOrganization(code: 1, name: "org1");
            var domain1 = new Domain {
                Name = "domain1", Organization = org1
            };
            var user1 = new UserAdmin {
                AccountName = "user1", Name = "user1", Password = Utils.HashPassword("user1"), Domain = domain1
            };

            _context.AddRange(org1, domain1, user1);
            _context.SaveChanges();

            var(response, body, _) = Utils.Get(_client, Url, "user1", "user1", 1, "domain1");  // ユーザー管理者
            Assert.Equal(HttpStatusCode.Forbidden, response.StatusCode);
            Assert.Empty(body);
        }
        public void Case01()
        {
            var simDevice1 = new SimAndDevice() // 組織 : '自組織
            {
                Sim                    = _sim1,
                Device                 = _device1,
                IsolatedNw2Ip          = "127.0.0.1",
                AuthenticationDuration = 1,
                StartDate              = DateTime.Parse("2020-02-07"),
                EndDate                = DateTime.Now.AddHours(6.00)
            };
            var simDevice2 = new SimAndDevice() // 組織 : '自組織
            {
                Sim                    = _sim1a,
                Device                 = _device1,
                IsolatedNw2Ip          = "127.0.0.1",
                AuthenticationDuration = 1,
                StartDate              = DateTime.Parse("2020-02-07"),
            };
            var simDevice3 = new SimAndDevice() // 組織 : '自組織
            {
                Sim                    = _sim1a,
                Device                 = _device2,
                IsolatedNw2Ip          = "127.0.0.1",
                AuthenticationDuration = 1,
                StartDate              = DateTime.Parse("2020-02-07"),
            };
            var simDevice5 = new SimAndDevice() // 組織 : '他組織
            {
                Sim                    = _sim2,
                Device                 = _device1,
                IsolatedNw2Ip          = "127.0.0.1",
                AuthenticationDuration = 1,
                StartDate              = DateTime.Parse("2020-02-07"),
            };

            _context.AddRange(simDevice5, simDevice1, simDevice2, simDevice3);
            _context.SaveChanges();
            var(response, _, json) = Utils.Get(_client, $"{Url}/?", "user1", "user1", 1, "domain01");  // ユーザー管理者
            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
            var list = (JArray)json["results"];

            Assert.Equal(3, list.Count);
            Assert.Equal(3, (int)json["count"]);
            Assert.Equal("msisdn01", list[0]["sim"]["msisdn"]);
            Assert.Equal("msisdn01a", list[1]["sim"]["msisdn"]); //SIM(MSISDN)ソート:'昇順
            Assert.Equal("device01", list[1]["device"]["name"]);
            Assert.Equal("device02", list[2]["device"]["name"]); // 端末ソート:'昇順
        }
        public void Case15()
        {
            var sim1 = new Sim()  //自組織
            {
                Msisdn   = "1001",
                Imsi     = "1001",
                IccId    = "1001",
                UserName = "******",
                Password = "******",
                SimGroup = _simGroup1
            };
            var sim2 = new Sim() // 他組織
            {
                Msisdn   = "1002",
                Imsi     = "1002",
                IccId    = "1002",
                UserName = "******",
                Password = "******",
                SimGroup = _simGroup2
            };

            _context.AddRange(sim1, sim2);
            _context.SaveChanges();

            var obj = new StringBuilder();

            obj.AppendLine("is Delete,ID,SIM Group ID,SIM Group Name,MSISDN,IMSI,ICC ID,User Name,Password");
            obj.AppendLine($"a,{sim1.Id},{_simGroup1.Id},{_simGroup1.Name},{sim1.Msisdn},{sim1.Imsi},{sim1.IccId},sim001,123456");
            obj.AppendLine($"a,{sim2.Id},{_simGroup2.Id},{_simGroup2.Name},{sim2.Msisdn},{sim2.Imsi},{sim2.IccId},sim002,123456");    //DBにSIM:他組織

            var(response, body, _) = Utils.Post(_client, $"{Url}", Utils.CreateFormContent(obj.ToString(), "csv"), "user0", "user0"); // スーパー管理者
            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
            var list = JArray.Parse(body);

            Assert.Equal("sim001", list[0]["userName"]);
            Assert.Equal("sim002", list[1]["userName"]);
        }
        public void Case01()
        {
            var org1    = Utils.CreateOrganization(code: 1, name: "org1", isValid: false); // isValid: false
            var domain1 = new Domain {
                Id = Guid.NewGuid(), Name = "domain1", Organization = org1
            };
            var user1 = new UserAdmin {
                AccountName = "user1", Name = "", Domain = domain1, Password = Utils.HashPassword("user1")
            };

            _context.AddRange(org1, domain1, user1);
            _context.SaveChanges();

            var query    = new { organizationCode = 1, domainName = "domain1", userName = "******", password = "******" };
            var response = _client.PostAsync(LoginUrl, Utils.CreateJsonContent(query)).Result;

            Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
        }
        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 void Case05()
        {
            var multiFactor1 = new MultiFactor // 組織 : '自組織
            {
                Id             = Guid.NewGuid(),
                SimAndDeviceId = _simDevice1.Id,
                EndUserId      = _user3.Id,
                ClosedNwIp     = "127.0.0.1",
                StartDate      = DateTime.Parse("2020-02-07"),
                EndDate        = DateTime.Parse("2021-02-07"),
            };
            var multiFactor2 = new MultiFactor // 組織 : '自組織
            {
                Id           = Guid.NewGuid(),
                SimAndDevice = _simDevice1a, // SIM
                EndUserId    = _user3.Id,
                ClosedNwIp   = "127.0.0.1",
                StartDate    = DateTime.Parse("2020-02-07"),
                EndDate      = DateTime.Parse("2021-02-07"),
            };
            var multiFactor3 = new MultiFactor // 組織 : '自組織
            {
                Id           = Guid.NewGuid(),
                SimAndDevice = _simDevice1b, // Device
                EndUserId    = _user3.Id,
                ClosedNwIp   = "127.0.0.1",
                StartDate    = DateTime.Parse("2020-02-07"),
                EndDate      = DateTime.Parse("2021-02-07"),
            };
            var multiFactor4 = new MultiFactor // 組織 : '自組織
            {
                Id           = Guid.NewGuid(),
                SimAndDevice = _simDevice1b,
                EndUserId    = _user3a.Id, //user
                ClosedNwIp   = "127.0.0.1",
                StartDate    = DateTime.Parse("2020-02-07"),
                EndDate      = DateTime.Parse("2021-02-07"),
            };
            var multiFactor5 = new MultiFactor // 組織 : '他組織
            {
                Id           = Guid.NewGuid(),
                SimAndDevice = _simDevice1,
                EndUserId    = _user4.Id, // user 他組織
                ClosedNwIp   = "127.0.0.1",
                StartDate    = DateTime.Parse("2020-02-07"),
                EndDate      = DateTime.Parse("2021-02-07"),
            };

            _context.AddRange(multiFactor1, multiFactor2, multiFactor3, multiFactor4, multiFactor5);
            _context.SaveChanges();
            var(response, _, json) = Utils.Get(_client, $"{Url}/?OrganizationCode={_org1.Code}", "user0", "user0"); //    スーパー管理者
            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
            var list = (JArray)json["results"];

            Assert.Equal(4, list.Count);
            Assert.Equal(4, (int)json["count"]);
            Assert.Equal("msisdn01", list[0]["simAndDevice"]["sim"]["msisdn"]);
            Assert.Equal("msisdn01a", list[1]["simAndDevice"]["sim"]["msisdn"]);  //SIM(MSISDN)ソート:'昇順
            Assert.Equal("device01", list[1]["simAndDevice"]["device"]["name"]);
            Assert.Equal("device01a", list[2]["simAndDevice"]["device"]["name"]); // 端末ソート:'昇順
            Assert.Equal("user3", list[2]["endUser"]["accountName"]);
            Assert.Equal("user3a", list[3]["endUser"]["accountName"]);            // ユーザーソート:'昇順
        }
Exemple #21
0
        private void SetDataUserGroup06()
        {
            var userGroup = new UserGroup()
            {
                Name       = "userGroup01",
                Domain     = Domain,
                AdObjectId = Guid.Parse("6cb543a0-e409-4e7f-9b7f-8dc958ff62ac") //削除
            };
            //user7-9
            var user1 = new UserAdmin()
            {
                AccountName       = "accountUser01",
                Name              = "user01",
                Password          = "******",
                UserGroupEndUsers = new HashSet <UserGroupEndUser>()
                {
                    new UserGroupEndUser()
                    {
                        UserGroup = userGroup
                    }
                },
                Domain           = Domain,
                AvailablePeriods = new HashSet <AvailablePeriod>(new List <AvailablePeriod>(new AvailablePeriod[]
                {
                    new AvailablePeriod()
                    {
                        StartDate = DateTime.Parse("2020-03-01"), EndDate = CurrentDateTimeForStart.Item1
                    },                                                                                                           // 最も新しい日付(実行日より同日)
                    new AvailablePeriod()
                    {
                        StartDate = DateTime.Parse("2020-03-01"), EndDate = DateTime.Parse("2020-01-09")
                    },
                })),
                AdObjectId = Guid.NewGuid()
            };
            var user2 = new UserAdmin()
            {
                AccountName       = "accountUser02",
                Name              = "user02",
                Password          = "******",
                UserGroupEndUsers = new HashSet <UserGroupEndUser>()
                {
                    new UserGroupEndUser()
                    {
                        UserGroup = userGroup
                    }
                },
                Domain           = Domain,
                AvailablePeriods = new HashSet <AvailablePeriod>(new List <AvailablePeriod>(new AvailablePeriod[]
                {
                    new AvailablePeriod()
                    {
                        StartDate = DateTime.Parse("2020-03-01"), EndDate = CurrentDateTimeForStart.Item2
                    },                                                                                                           // 最も新しい日付(実行日より未来)
                    new AvailablePeriod()
                    {
                        StartDate = DateTime.Parse("2020-03-01"), EndDate = DateTime.Parse("2020-01-09")
                    },
                })),
                AdObjectId = Guid.NewGuid()
            };
            var user3 = new UserAdmin()
            {
                AccountName       = "accountUser03",
                Name              = "user03",
                Password          = "******",
                UserGroupEndUsers = new HashSet <UserGroupEndUser>()
                {
                    new UserGroupEndUser()
                    {
                        UserGroup = userGroup
                    }
                },
                Domain           = Domain,
                AvailablePeriods = new HashSet <AvailablePeriod>(new List <AvailablePeriod>(new AvailablePeriod[]
                {
                    new AvailablePeriod()
                    {
                        StartDate = DateTime.Parse("2020-03-01"), EndDate = null
                    },                                                                                  // 不在
                    new AvailablePeriod()
                    {
                        StartDate = DateTime.Parse("2020-03-01"), EndDate = DateTime.Parse("2020-01-09")
                    },
                })),
                AdObjectId = Guid.NewGuid()
            };

            MainDbContext.MultiFactor.Add(new MultiFactor()
            {
                EndUser      = user1,
                ClosedNwIp   = "",
                SimAndDevice = new SimAndDevice()
                {
                    Device = new Device()
                    {
                        Domain = Domain,
                        Name   = "device001",
                        UseTpm = true,
                        WindowsSignInListCacheDays = 1,
                        StartDate             = DateTime.Parse("2020-03-01"),
                        ManagedNumber         = "",
                        SerialNumber          = "",
                        ProductName           = "",
                        AdObjectId            = Guid.NewGuid(),
                        OrganizationClientApp = OrganizationClientApp,
                        EndDate = null // EndDate : 不在
                    },
                    Sim = new Sim()
                    {
                        Msisdn   = "111111111122",
                        Imsi     = "11111111122",
                        IccId    = "11111111122",
                        UserName = "******",
                        Password = "******",
                        SimGroup = SimGroup1
                    },
                    IsolatedNw2Ip          = "",
                    AuthenticationDuration = 1,
                    StartDate = DateTime.Parse("2020-03-01"),
                    EndDate   = CurrentDateTimeForEnd.Item1 // endDate:'実行日より過去
                },
                StartDate = DateTime.Parse("2020-03-01"),
                EndDate   = DateTime.Parse("2020-01-09") //最も古い日付
            });
            MainDbContext.MultiFactor.Add(new MultiFactor()
            {
                EndUser      = user1,
                ClosedNwIp   = "",
                SimAndDevice = new SimAndDevice()
                {
                    Device = new Device()
                    {
                        Domain = Domain,
                        Name   = "device002",
                        UseTpm = true,
                        WindowsSignInListCacheDays = 1,
                        StartDate             = DateTime.Parse("2020-03-01"),
                        ManagedNumber         = "",
                        SerialNumber          = "",
                        ProductName           = "",
                        AdObjectId            = Guid.NewGuid(),
                        OrganizationClientApp = OrganizationClientApp,
                        EndDate = null // EndDate : 不在
                    },
                    Sim = new Sim()
                    {
                        Msisdn   = "1111111112",
                        Imsi     = "111111112",
                        IccId    = "111111112",
                        UserName = "******",
                        Password = "******",
                        SimGroup = SimGroup1
                    },
                    IsolatedNw2Ip          = "",
                    AuthenticationDuration = 1,
                    StartDate = DateTime.Parse("2020-03-01"),
                    EndDate   = CurrentDateTimeForStart.Item1 // endDate:''実行日と同日
                },
                StartDate = DateTime.Parse("2020-03-01"),
                EndDate   = DateTime.Parse("2020-01-09") //最も古い日付
            });

            MainDbContext.MultiFactor.Add(new MultiFactor()
            {
                EndUser      = user2,
                ClosedNwIp   = "",
                SimAndDevice = new SimAndDevice()
                {
                    Device = new Device()
                    {
                        Domain = Domain,
                        Name   = "device003",
                        UseTpm = true,
                        WindowsSignInListCacheDays = 1,
                        StartDate             = DateTime.Parse("2020-03-01"),
                        ManagedNumber         = "",
                        SerialNumber          = "",
                        ProductName           = "",
                        AdObjectId            = Guid.NewGuid(),
                        OrganizationClientApp = OrganizationClientApp,
                        EndDate = null // EndDate : 不在
                    },
                    Sim = new Sim()
                    {
                        Msisdn   = "1111111113",
                        Imsi     = "111111113",
                        IccId    = "111111113",
                        UserName = "******",
                        Password = "******",
                        SimGroup = SimGroup1
                    },
                    IsolatedNw2Ip          = "",
                    AuthenticationDuration = 1,
                    StartDate = DateTime.Parse("2020-03-01"),
                    EndDate   = CurrentDateTimeForEnd.Item1 // endDate:'実行日より過去
                },
                StartDate = DateTime.Parse("2020-03-01"),
                EndDate   = DateTime.Parse("2020-01-09") //最も古い日付
            });
            MainDbContext.MultiFactor.Add(new MultiFactor()
            {
                EndUser      = user2,
                ClosedNwIp   = "",
                SimAndDevice = new SimAndDevice()
                {
                    Device = new Device()
                    {
                        Domain = Domain,
                        Name   = "device004",
                        UseTpm = true,
                        WindowsSignInListCacheDays = 1,
                        StartDate             = DateTime.Parse("2020-03-01"),
                        ManagedNumber         = "",
                        SerialNumber          = "",
                        ProductName           = "",
                        AdObjectId            = Guid.NewGuid(),
                        OrganizationClientApp = OrganizationClientApp,
                        EndDate = null // EndDate : 不在
                    },
                    Sim = new Sim()
                    {
                        Msisdn   = "1111111115",
                        Imsi     = "111111115",
                        IccId    = "111111115",
                        UserName = "******",
                        Password = "******",
                        SimGroup = SimGroup1
                    },
                    IsolatedNw2Ip          = "",
                    AuthenticationDuration = 1,
                    StartDate = DateTime.Parse("2020-03-01"),
                    EndDate   = CurrentDateTimeForStart.Item2 // endDate:''実行日と未来
                },
                StartDate = DateTime.Parse("2020-03-01"),
                EndDate   = DateTime.Parse("2020-01-09") //最も古い日付
            });

            MainDbContext.MultiFactor.Add(new MultiFactor()
            {
                EndUser      = user3,
                ClosedNwIp   = "",
                SimAndDevice = new SimAndDevice()
                {
                    Device = new Device()
                    {
                        Domain = Domain,
                        Name   = "device005",
                        UseTpm = true,
                        WindowsSignInListCacheDays = 1,
                        StartDate             = DateTime.Parse("2020-03-01"),
                        ManagedNumber         = "",
                        SerialNumber          = "",
                        ProductName           = "",
                        AdObjectId            = Guid.NewGuid(),
                        OrganizationClientApp = OrganizationClientApp,
                        EndDate = null // EndDate : 不在
                    },
                    Sim = new Sim()
                    {
                        Msisdn   = "1111111116",
                        Imsi     = "111111116",
                        IccId    = "111111116",
                        UserName = "******",
                        Password = "******",
                        SimGroup = SimGroup1
                    },
                    IsolatedNw2Ip          = "",
                    AuthenticationDuration = 1,
                    StartDate = DateTime.Parse("2020-03-01"),
                    EndDate   = CurrentDateTimeForEnd.Item1 // endDate:'実行日より過去
                },
                StartDate = DateTime.Parse("2020-03-01"),
                EndDate   = DateTime.Parse("2020-01-09") //最も古い日付
            });
            MainDbContext.MultiFactor.Add(new MultiFactor()
            {
                EndUser      = user3,
                ClosedNwIp   = "",
                SimAndDevice = new SimAndDevice()
                {
                    Device = new Device()
                    {
                        Domain = Domain,
                        Name   = "device006",
                        UseTpm = true,
                        WindowsSignInListCacheDays = 1,
                        StartDate             = DateTime.Parse("2020-03-01"),
                        ManagedNumber         = "",
                        SerialNumber          = "",
                        ProductName           = "",
                        AdObjectId            = Guid.NewGuid(),
                        OrganizationClientApp = OrganizationClientApp,
                        EndDate = null // EndDate : 不在
                    },
                    Sim = new Sim()
                    {
                        Msisdn   = "1111111117",
                        Imsi     = "111111117",
                        IccId    = "111111117",
                        UserName = "******",
                        Password = "******",
                        SimGroup = SimGroup1
                    },
                    IsolatedNw2Ip          = "",
                    AuthenticationDuration = 1,
                    StartDate = DateTime.Parse("2020-03-01"),
                    EndDate   = null // endDate:null
                },
                StartDate = DateTime.Parse("2020-03-01"),
                EndDate   = DateTime.Parse("2020-01-09") //最も古い日付
            });
            MainDbContext.AddRange(userGroup, user1, user2, user3);
        }
Exemple #22
0
        public void CreateDataCase09()
        {
            CreateBaseData();
            Organization.StartDate = CurrentDateTimeForEnd.Item1;   // '実行日より過去
            Organization.EndDate   = CurrentDateTimeForStart.Item1; // '実行日と同日
            //Ad-Domain-4

            //JinCreek-Domain-4
            //DeviceGroup-3~5
            var deviceGroup1 = new DeviceGroup()
            {
                Domain     = Domain,
                Name       = "deviceGroup01Case09",
                AdObjectId = Guid.Parse("435cd502-5a65-4649-8a39-1e53294304f8"), // 削除
            };

            Device1 = new Device() // Devive-6
            {
                Domain = Domain,
                Name   = "device01",
                UseTpm = true,
                WindowsSignInListCacheDays = 1,
                StartDate             = DateTime.Parse("2020-03-01"),
                ManagedNumber         = "",
                SerialNumber          = "",
                ProductName           = "",
                AdObjectId            = Guid.NewGuid(),
                OrganizationClientApp = OrganizationClientApp,
                LteModule             = new LteModule()
                {
                    Name                  = "lte0001",
                    NwAdapterName         = "",
                    UseSoftwareRadioState = true
                },
                DeviceGroupDevices = new HashSet <DeviceGroupDevice>()
                {
                    new DeviceGroupDevice()
                    {
                        DeviceGroup = deviceGroup1
                    }
                },
                EndDate = null                              // EndDate : 不在
            };
            MainDbContext.DeviceGroup.Add(new DeviceGroup() //deviceGroup-5
            {
                Domain = Domain,
                Name   = "deviceGroup03"
            });
            var deviceGroup2 = new DeviceGroup()//deviceGroup-4
            {
                Domain     = Domain,
                Name       = "deviceGroup02",
                AdObjectId = Guid.Parse("d31166e2-7918-4608-967c-b9fea0449232") //更新
            };

            MainDbContext.Device.Add(new Device() // Devive-2
            {
                Domain = Domain,
                Name   = "device02",
                UseTpm = true,
                WindowsSignInListCacheDays = 1,
                StartDate             = DateTime.Parse("2020-03-01"),
                ManagedNumber         = "",
                SerialNumber          = "",
                ProductName           = "",
                AdObjectId            = Guid.Parse("2bfbea62-566c-4006-9151-2366704d0792"),
                OrganizationClientApp = OrganizationClientApp,
                LteModule             = new LteModule()
                {
                    Name                  = "lte05",
                    NwAdapterName         = "",
                    UseSoftwareRadioState = true
                },
                DeviceGroupDevices = new HashSet <DeviceGroupDevice>()
                {
                    new DeviceGroupDevice()
                    {
                        DeviceGroup = deviceGroup2
                    }
                },
                EndDate = CurrentDateTimeForEnd.Item1, // EndDate : '実行日より過去
            });
            MainDbContext.Device.Add(new Device()      // Devive-3
            {
                Domain = Domain,
                Name   = "device03",
                UseTpm = true,
                WindowsSignInListCacheDays = 1,
                StartDate             = DateTime.Parse("2020-03-01"),
                ManagedNumber         = "",
                SerialNumber          = "",
                ProductName           = "",
                AdObjectId            = Guid.Parse("bddc4bd2-b49c-46c2-8af0-28e17e22e7a5"),
                OrganizationClientApp = OrganizationClientApp,
                LteModule             = new LteModule()
                {
                    Name                  = "lte02",
                    NwAdapterName         = "",
                    UseSoftwareRadioState = true
                },
                DeviceGroupDevices = new HashSet <DeviceGroupDevice>()
                {
                    new DeviceGroupDevice()
                    {
                        DeviceGroup = deviceGroup2
                    }
                },
                EndDate = CurrentDateTimeForStart.Item1 // EndDate : '実行日と同日
            });
            MainDbContext.Device.Add(new Device()       // Devive-4
            {
                Domain = Domain,
                Name   = "device04",
                UseTpm = true,
                WindowsSignInListCacheDays = 1,
                StartDate             = DateTime.Parse("2020-03-01"),
                ManagedNumber         = "",
                SerialNumber          = "",
                ProductName           = "",
                AdObjectId            = Guid.Parse("998f3dd1-2596-4c2d-8793-9b8c5ed2167d"),
                OrganizationClientApp = OrganizationClientApp,
                LteModule             = new LteModule()
                {
                    Name                  = "lte03",
                    NwAdapterName         = "",
                    UseSoftwareRadioState = true
                },
                DeviceGroupDevices = new HashSet <DeviceGroupDevice>()
                {
                    new DeviceGroupDevice()
                    {
                        DeviceGroup = deviceGroup2
                    }
                },
                EndDate = CurrentDateTimeForStart.Item2 // EndDate : '実行日より未来
            });
            MainDbContext.Device.Add(new Device()       // Devive-5
            {
                Domain = Domain,
                Name   = "device05",
                UseTpm = true,
                WindowsSignInListCacheDays = 1,
                StartDate             = DateTime.Parse("2020-03-01"),
                ManagedNumber         = "",
                SerialNumber          = "",
                ProductName           = "",
                AdObjectId            = Guid.Parse("ceeb02cc-fd3d-4165-80f9-989ba64e4ffb"),
                OrganizationClientApp = OrganizationClientApp,
                LteModule             = new LteModule()
                {
                    Name                  = "lte04",
                    NwAdapterName         = "",
                    UseSoftwareRadioState = true
                },
                DeviceGroupDevices = new HashSet <DeviceGroupDevice>()
                {
                    new DeviceGroupDevice()
                    {
                        DeviceGroup = deviceGroup2
                    }
                },
                EndDate = null // EndDate : 不在
            });
            //userGroup3~5
            var userGroup1 = new UserGroup()
            {
                AdObjectId = Guid.Parse("6cb543a0-e409-4e7f-9b7f-8dc958ff62ac"), //削除
                Domain     = Domain,
                Name       = "userGroup01",
            };

            MainDbContext.User.Add(new UserAdmin()
            {
                AccountName       = "accountUser01",
                Name              = "user01",
                Password          = "******",
                UserGroupEndUsers = new HashSet <UserGroupEndUser>()
                {
                    new UserGroupEndUser()
                    {
                        UserGroup = userGroup1
                    }
                },
                Domain           = Domain,
                AvailablePeriods = new HashSet <AvailablePeriod>(new List <AvailablePeriod>(new AvailablePeriod[]
                {
                    new AvailablePeriod()
                    {
                        StartDate = DateTime.Parse("2020-03-01"), EndDate = CurrentDateTimeForEnd.Item1
                    },                                                                                                         // 最も新しい日付(実行日より過去)
                    new AvailablePeriod()
                    {
                        StartDate = DateTime.Parse("2020-03-01"), EndDate = DateTime.Parse("2020-01-09")
                    },
                }))
            });
            var userGroup2 = new UserGroup()
            {
                AdObjectId = Guid.Parse("bcd40870-d1ff-4f45-b9cb-e56b48d60028"), //更新 
                Domain     = Domain,
                Name       = "userGroup02",
            };

            MainDbContext.UserGroup.Add(new UserGroup()
            {
                AdObjectId = Guid.NewGuid(),
                Domain     = Domain,
                Name       = "userGroup03",
            });
            MainDbContext.User.Add(new UserAdmin()
            {
                AccountName       = "accountUser02",
                Name              = "user02",
                Password          = "******",
                UserGroupEndUsers = new HashSet <UserGroupEndUser>()
                {
                    new UserGroupEndUser()
                    {
                        UserGroup = userGroup2
                    }
                },
                Domain           = Domain,
                AvailablePeriods = new HashSet <AvailablePeriod>(new List <AvailablePeriod>(new AvailablePeriod[]
                {
                    new AvailablePeriod()
                    {
                        StartDate = DateTime.Parse("2020-03-01"), EndDate = CurrentDateTimeForEnd.Item1
                    },                                                                                                         // 最も新しい日付(実行日より過去)
                    new AvailablePeriod()
                    {
                        StartDate = DateTime.Parse("2020-03-01"), EndDate = DateTime.Parse("2020-01-09")
                    },
                }))
            });
            MainDbContext.User.Add(new UserAdmin()
            {
                AccountName       = "accountUser03",
                Name              = "user03",
                Password          = "******",
                UserGroupEndUsers = new HashSet <UserGroupEndUser>()
                {
                    new UserGroupEndUser()
                    {
                        UserGroup = userGroup2
                    }
                },
                Domain           = Domain,
                AvailablePeriods = new HashSet <AvailablePeriod>(new List <AvailablePeriod>(new AvailablePeriod[]
                {
                    new AvailablePeriod()
                    {
                        StartDate = DateTime.Parse("2020-03-01"), EndDate = CurrentDateTimeForStart.Item1
                    },                                                                                                           // 最も新しい日付(実行日より同日)
                    new AvailablePeriod()
                    {
                        StartDate = DateTime.Parse("2020-03-01"), EndDate = DateTime.Parse("2020-01-09")
                    },
                }))
            });
            MainDbContext.User.Add(new UserAdmin()
            {
                AccountName       = "accountUser04",
                Name              = "user04",
                Password          = "******",
                UserGroupEndUsers = new HashSet <UserGroupEndUser>()
                {
                    new UserGroupEndUser()
                    {
                        UserGroup = userGroup2
                    }
                },
                Domain           = Domain,
                AvailablePeriods = new HashSet <AvailablePeriod>(new List <AvailablePeriod>(new AvailablePeriod[]
                {
                    new AvailablePeriod()
                    {
                        StartDate = DateTime.Parse("2020-03-01"), EndDate = CurrentDateTimeForStart.Item2
                    },                                                                                                           // 最も新しい日付(実行日より未来)
                    new AvailablePeriod()
                    {
                        StartDate = DateTime.Parse("2020-03-01"), EndDate = DateTime.Parse("2020-01-09")
                    },
                }))
            });
            MainDbContext.User.Add(new UserAdmin()
            {
                AccountName       = "accountUser05",
                Name              = "user05",
                Password          = "******",
                UserGroupEndUsers = new HashSet <UserGroupEndUser>()
                {
                    new UserGroupEndUser()
                    {
                        UserGroup = userGroup2
                    }
                },
                Domain           = Domain,
                AvailablePeriods = new HashSet <AvailablePeriod>(new List <AvailablePeriod>(new AvailablePeriod[]
                {
                    new AvailablePeriod()
                    {
                        StartDate = DateTime.Parse("2020-03-01"), EndDate = null
                    },                                                                                  // 不在
                    new AvailablePeriod()
                    {
                        StartDate = DateTime.Parse("2020-03-01"), EndDate = DateTime.Parse("2020-01-09")
                    },
                }))
            });
            MainDbContext.AddRange(deviceGroup1, deviceGroup2, Device1, userGroup1, userGroup2);
            MainDbContext.SaveChanges();
        }
Exemple #23
0
        private void SetDataDeviceGroup06()
        {
            //DeviceGroup-6
            var deviceGroup = new DeviceGroup()
            {
                Domain     = Domain,
                Name       = "deviceGroup01",
                AdObjectId = Guid.Parse("435cd502-5a65-4649-8a39-1e53294304f8") //削除
            };

            Device1 = new Device() // Devive-7
            {
                Domain = Domain,
                Name   = "device01",
                UseTpm = true,
                WindowsSignInListCacheDays = 1,
                StartDate             = DateTime.Parse("2020-03-01"),
                ManagedNumber         = "",
                SerialNumber          = "",
                ProductName           = "",
                AdObjectId            = Guid.NewGuid(),
                OrganizationClientApp = OrganizationClientApp,
                LteModule             = new LteModule()
                {
                    Name                  = "lte01",
                    NwAdapterName         = "",
                    UseSoftwareRadioState = true
                },
                DeviceGroupDevices = new HashSet <DeviceGroupDevice>()
                {
                    new DeviceGroupDevice()
                    {
                        DeviceGroup = deviceGroup
                    }
                },
                EndDate = null // EndDate : 不在
            };
            SimAndDevice1 = new SimAndDevice()
            {
                Device                 = Device1,
                Sim                    = Sim1,
                IsolatedNw2Ip          = "",
                AuthenticationDuration = 1,
                StartDate              = DateTime.Parse("2020-03-01"),
                EndDate                = DateTime.Parse("2021-03-02") // '存在(実行日以外)
            };
            MainDbContext.SimAndDevice.Add(new SimAndDevice()
            {
                Device = Device1,
                Sim    = new Sim()
                {
                    Msisdn   = "11111111112",
                    Imsi     = "1111111112",
                    IccId    = "1111111112",
                    UserName = "******",
                    Password = "******",
                    SimGroup = SimGroup1
                },
                IsolatedNw2Ip          = "",
                AuthenticationDuration = 1,
                StartDate = DateTime.Parse("2020-03-01") // endDate:不在
            });
            MainDbContext.AddRange(deviceGroup, Device1, SimAndDevice1);
        }