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(); }
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(); }
public override int GetHashCode() { int hash = 1; if (TargetEnvId.Length != 0) { hash ^= TargetEnvId.GetHashCode(); } if (ClientVersion.Length != 0) { hash ^= ClientVersion.GetHashCode(); } if (ClientOs != 0) { hash ^= ClientOs.GetHashCode(); } if (OsVersion.Length != 0) { hash ^= OsVersion.GetHashCode(); } if (DeviceModel.Length != 0) { hash ^= DeviceModel.GetHashCode(); } if (deviceInfoCase_ == DeviceInfoOneofCase.IosDeviceInfo) { hash ^= IosDeviceInfo.GetHashCode(); } if (deviceInfoCase_ == DeviceInfoOneofCase.AndroidDeviceInfo) { hash ^= AndroidDeviceInfo.GetHashCode(); } if (BuildNumber.Length != 0) { hash ^= BuildNumber.GetHashCode(); } hash ^= (int)deviceInfoCase_; if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public void Case08() { var organization = Utils.CreateOrganization(code: 5, name: "org5"); var clientOs = new ClientOs { Name = "Windows 10" }; var clientApp = new ClientApp { ClientOs = clientOs, Version = "1904" }; var organizationClientApp = new OrganizationClientApp { ClientApp = clientApp, Organization = organization }; _context.AddRange(organization, organizationClientApp); _context.SaveChanges(); var(response, _, json) = Utils.Delete(_client, $"{Url}/5", "user0", "user0"); // スーパー管理者 Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); Assert.NotNull(json["traceId"]); Assert.Null(json["errors"][nameof(SimGroup)]); Assert.Null(json["errors"][nameof(Domain)]); Assert.NotNull(json["errors"][nameof(OrganizationClientApp)]); // 存在 }
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(); }