public void ClientVisitCreate_NewUser() { Client.CreateData clientCreateData = ClientGenerator.GetClientCreateData("Иван", "Иванович", "Иванов", "1"); ClientBusinessLogic bll = new ClientBusinessLogic(); ClientVisit.SaveData data = ClientGenerator.GetClientVisitSaveDataForNewUser(); long clientId = bll.ClientVisit_Save(new User() { Roles = new List <Role>() { Role.Administrator } }, data).ClientID; Client client = bll.Client_Get(new User() { Roles = new List <Role>() { Role.Administrator } }, clientId); long visitId = client.Visits.OrderByDescending(item => item.StatusDate).FirstOrDefault().Id; ClientVisit visit = bll.ClientVisit_Get(visitId); Assert.IsNotNull(visit); Assert.IsNotNull(visit.LivingAddress); Assert.IsNotNull(visit.RegistrationAddress); Assert.IsNotNull(visit.OldClientInfo); Assert.IsNotNull(visit.NewClientInfo); Assert.IsNotNull(visit.OldDocument); Assert.IsNotNull(visit.NewDocument); Assert.IsNotNull(visit.NewPolicy); Assert.IsNotNull(visit.OldPolicy); }
public void SignIn10000Clients(NutritionClinic sut) { for (int i = 0; i < 10000; i++) { sut.SignInNewClient(ClientGenerator.GenerateRandomClient(sut)); } }
public Task <loginResponse> LoginAsync(loginRequest request) { ClientGenerator.WebServiceUrl = _webServiceUrl; ClientGenerator.InitializeService(); client = ClientGenerator.ServiceClient; return(client.loginAsync(request)); }
static void Main(string[] args) { var map = new Dictionary<string, string>(StringComparer.Ordinal); var key = (string)null; foreach (var item in args) { if (item.Length == 0) continue; if (item.StartsWith('-')) key = item; else if (key != null) map[key] = $"{(map.TryGetValue(key, out var value) ? value + " " : string.Empty)}{item.Trim(' ', '\'', '\"')}"; } if (!map.TryGetValue("-p", out var path) && !map.TryGetValue("--path", out path)) { throw new ArgumentException("Path missing, expect -p|--path path1 path2"); } if (!map.TryGetValue("-o", out var output) && !map.TryGetValue("--out", out output)) { throw new ArgumentException("Out missing, expect -o|--out path1 path2"); } if (!map.TryGetValue("-n", out var nameSpace) && !map.TryGetValue("--namespace", out nameSpace)) { //throw new ArgumentException("Namespace missing, expect -n|--namespace name space definition"); } if (!map.TryGetValue("-r", out var references) && !map.TryGetValue("--references", out references)) { //throw new ArgumentException("References missing, expect -r|--references paths to project or library"); } var generator = new ClientGenerator(path, output, nameSpace ?? "DataWF.Web.Client", references); generator.Generate(); generator.GetUnits(true); }
protected abstract Task <bool> Compile( TCtx context, string path, Configuration config, ClientGenerator generator, IReadOnlyList <DocumentInfo> documents, ICollection <HCError> errors);
private async Task <bool> Compile(string path, Configuration config) { var stopwatch = Stopwatch.StartNew(); WriteCompileStartedMessage(); var schemaFiles = new HashSet <string>(); ClientGenerator generator = ClientGenerator.New(); generator.SetOutput(IOPath.Combine(path, "Generated")); if (!string.IsNullOrEmpty(config.ClientName)) { generator.SetClientName(config.ClientName); } var errors = new List <HCError>(); await LoadGraphQLDocumentsAsync(path, generator, errors); if (errors.Count > 0) { WriteErrors(errors); return(false); } bool result = await Compile(path, config, generator); WriteCompileCompletedMessage(path, stopwatch); return(result); }
private async Task LoadGraphQLDocumentsAsync( string path, ClientGenerator generator, ICollection <HCError> errors) { Dictionary <string, SchemaFile> schemaConfigs = (await Configuration.LoadConfig(path)).Schemas.ToDictionary(t => t.Name); foreach (DocumentInfo document in await GetGraphQLFiles(path, errors)) { if (document.Kind == DocumentKind.Query) { generator.AddQueryDocument( IOPath.GetFileNameWithoutExtension(document.FileName), document.FileName, document.Document); } else { string name = IOPath.GetFileNameWithoutExtension( document.FileName); if (schemaConfigs.TryGetValue( IOPath.GetFileName(document.FileName), out SchemaFile file)) { name = file.Name; } generator.AddSchemaDocument( name, document.Document); } } }
static void Main(string[] args) { Console.Write("Press any key"); Console.ReadKey(); Console.WriteLine(); MessagePackSerializer.SetDefaultResolver(MessagePack.Resolvers.TypelessContractlessStandardResolver.Instance); var channel = new Channel("localhost", 12345, ChannelCredentials.Insecure); var client = ClientGenerator.GenerateClient <MyFirstServiceBase>(channel); var result = client.Get( "not so cool name", new string[] { "abc", "def", "ghi" }, DateTime.Now ); foreach (var item in result.Dates) { Console.WriteLine(item); } client.Set("cool name"); Console.Write("Press any key"); Console.ReadKey(); }
static void Main(string[] args) { var map = new Dictionary<string, string>(); var key = (string)null; foreach (var item in args) { if (item.Length == 0) continue; if (item.StartsWith('-')) key = item; else if (key != null) map[key] = $"{(map.TryGetValue(key, out var value) ? value + " " : string.Empty)}{item.Trim(' ', '\'', '\"')}"; } if (!map.TryGetValue("-p", out var path) && !map.TryGetValue("--path", out path)) { throw new ArgumentException("Path missing, expect -p|--path path1 path2"); } if (!map.TryGetValue("-o", out var output) && !map.TryGetValue("--out", out output)) { throw new ArgumentException("Out missing, expect -o|--out path1 path2"); } if (!map.TryGetValue("-n", out var nameSpace) && !map.TryGetValue("--namespace", out nameSpace)) { //throw new ArgumentException("Nmaespace missing, expect -n|--namespace Name.Space"); } var generator = new ClientGenerator(path, output, nameSpace); generator.Generate(); generator.GetUnits(true); }
public void SetUp() { clientBuilder = new ClientGenerator(); callManager = MockRepository.GenerateMock<ICallWrapper<ITestInterface>>(); callManager.Expect(x => x.Call(null)).IgnoreArguments().Do( new TestCall(DoCall)).Repeat.Any(); testImplementation = new TestInterfaceClass(callManager); }
public void CreateModels() { var c = new ClientGenerator("Links"); c.Initialize(new GeneratorInitializationContext()); var models = c.ModelDuplicator(); Console.WriteLine(models); }
static async Task Main() { _service = ClientGenerator.GenerateClass <IService>(new ServiceFinder(), new HttpClient()); await TestTuple(); TestBool(); await SendRequestHello(); await _service.ExecuteTask(); }
public void ClientVisit_Find() { Client.CreateData clientCreateData = ClientGenerator.GetClientCreateData("Иван", "Иванович", "Иванов", "1"); ClientBusinessLogic bll = new ClientBusinessLogic(); ClientVisit.SaveData data = ClientGenerator.GetClientVisitSaveDataForNewUser(); long clientId = bll.ClientVisit_Save(new User() { Roles = new List <Role>() { Role.Administrator } }, data).ClientID; Client client = bll.Client_Get(new User() { Roles = new List <Role>() { Role.Administrator } }, clientId); long visitId = client.Visits.OrderByDescending(item => item.StatusDate).FirstOrDefault().Id; ClientVisit visit = bll.ClientVisit_Get(visitId); ClientVisitSearchCriteria criteria = new ClientVisitSearchCriteria(); criteria.Firstname = data.NewClientInfo.Firstname; criteria.Secondname = data.NewClientInfo.Secondname; criteria.Lastname = data.NewClientInfo.Lastname; criteria.Birthday = data.NewClientInfo.Birthday; criteria.DeliveryCenterIds = new List <long>(); if (data.DeliveryCenterId.HasValue) { criteria.DeliveryCenterIds.Add(data.DeliveryCenterId.Value); } criteria.Id = visitId; criteria.PolicyDateTo = visit.IssueDate; criteria.PolicyNumber = visit.NewPolicy.Number; criteria.PolicySeries = visit.NewPolicy.Series; criteria.StatusIds = new List <long>(); if (data.Status.HasValue) { criteria.StatusIds.Add(data.Status.Value); } criteria.TemporaryPolicyDateTo = visit.TemporaryPolicyDate; criteria.TemporaryPolicyNumber = visit.TemporaryPolicyNumber; DataPage <ClientVisitInfo> list = bll.ClientVisit_Find( criteria, new List <SortCriteria <ClientVisitSortField> >(), new PageRequest() { PageNumber = 1, PageSize = 10 }); Assert.AreEqual(list.Count, 1); }
//CONSTRUCTOR public MySimulation(TextInput input, NutritionClinic theClinic) { this.input = input; startTime = DateTime.Now; runningTime = DateTime.Now; this.TheClinic = theClinic; simState = new StandardState("MESSAGEBOARD"); messageBoard.Log($"This is the {theClinic.Name} nutrition clinic!"); messageBoard.Log($"We help people get back in shape. Lets start by signing in a new client!"); messageBoard.Log(theClinic.SignInNewClient(ClientGenerator.GenerateRandomClient(theClinic))); }
protected override async Task <bool> Compile( GenerateCommandContext context, string path, Configuration config, ClientGenerator generator, IReadOnlyList <DocumentInfo> documents, ICollection <HCError> errors) { string hashFile = FileSystem.CombinePath( path, WellKnownDirectories.Generated, WellKnownFiles.Hash); if (await SkipCompileAsync(hashFile, documents, context.Force) .ConfigureAwait(false)) { return(true); } generator.ModifyOptions(o => { o.LanguageVersion = context.Language; o.EnableDISupport = context.DISupport; }); generator.SetNamespace(context.Namespace); IReadOnlyList <HCError> validationErrors = generator.Validate(); if (validationErrors.Count > 0) { foreach (HCError error in validationErrors) { errors.Add(error); } return(false); } await generator.BuildAsync().ConfigureAwait(false); await Task.Run(() => File.WriteAllText(hashFile, CreateHash(documents))) .ConfigureAwait(false); if (context.PersistedQueryFile is { } fileName) { using IActivity activity = Output.WriteActivity("Export queries", fileName); FileSystem.EnsureDirectoryExists(FileSystem.GetDirectoryName(fileName)); await generator.ExportPersistedQueriesAsync(fileName).ConfigureAwait(false); } return(true); }
private async Task LoadGraphQLDocumentsAsync( string path, ClientGenerator generator, ICollection <HCError> errors) { Configuration?configuration = await Configuration.LoadConfig(path); if (configuration is null) { throw new InvalidOperationException( "The configuration does not exist."); } if (configuration.Schemas is null) { throw new InvalidOperationException( "The configuration has no schemas defined."); } Dictionary <string, SchemaFile> schemas = configuration.Schemas.Where(t => t.Name != null) .ToDictionary(t => t.Name !); foreach (DocumentInfo document in await GetGraphQLFiles(path, errors)) { if (document.Kind == DocumentKind.Query) { generator.AddQueryDocument( IOPath.GetFileNameWithoutExtension(document.FileName), document.FileName, document.Document); } else { string name = IOPath.GetFileNameWithoutExtension( document.FileName); if (schemas.TryGetValue( IOPath.GetFileName(document.FileName), out SchemaFile? file)) { name = file.Name !; } generator.AddSchemaDocument( name, document.Document); } } }
public void ClientGenerator_NeverProducesNormalWeightClient() { NutritionClinic sutClinic = SetUpTestClinic(); for (int i = 0; i < 10000; i++) { Client sut = ClientGenerator.GenerateRandomClient(sutClinic); if (sut.BMI > 18.5 && sut.BMI < 25) { Assert.Fail(); } } Assert.Pass(); }
protected override Task <bool> Compile( string path, Configuration config, ClientGenerator generator) { IReadOnlyList <HCError> validationErrors = generator.Validate(); if (validationErrors.Count > 0) { WriteErrors(validationErrors); return(Task.FromResult(false)); } return(Task.FromResult(true)); }
//METHODS public override void PassTime(int deltaTime) { runningTime = runningTime.AddMinutes(30).AddMilliseconds(deltaTime); patientInfo.Value = $"CURRENT CLIENT: {Environment.NewLine}{CurrentClient.GetCurrentState()}{Environment.NewLine}{Environment.NewLine}" + $"CLIENT GOALS: {Environment.NewLine}{CurrentClient.GetGoals()}{Environment.NewLine}{Environment.NewLine}" + $"TODAYS INTAKE:{Environment.NewLine}{CurrentClient.GetTodaysIntake()}"; clockDisplay.Value = "Current time: " + runningTime.ToString("HH:mm:ss"); clinicInfo.Value = $"CLINIC NAME: {TheClinic.Name} {Environment.NewLine}{Environment.NewLine}CLINIC STAFF: {Environment.NewLine}{TheDietitian.Position}: {TheDietitian.Name} {Environment.NewLine}{ThePersonalTrainer.Position}: {ThePersonalTrainer.Name} {Environment.NewLine}{Environment.NewLine}CLIENTS HELPED:{Environment.NewLine}{TheClinic.ClientRecord.Count - 1}"; if (runningTime.Day > startTime.Day) { messageBoard.Log("It's a new day! Let's check the progress:"); messageBoard.Log(CurrentClient.CheckTodaysIntake()); startTime = runningTime; } if (CurrentClient.NeedsHozpitalization()) { messageBoard.Log("Oups, this has gotten out of hand"); messageBoard.Log($"{CurrentClient.Name} is dangerouzly underweight and needs hospital care"); messageBoard.Log($"Bye {CurrentClient.Name} hope you feel better soon"); messageBoard.Log($"Let's sign in a new patient"); messageBoard.Log(TheClinic.SignInNewClient(ClientGenerator.GenerateRandomClient(TheClinic))); } if (CurrentClient.HasReachedNormalWeight()) { messageBoard.Log("Congrats, the client has reached normal BMI!"); messageBoard.Log($"We will sign him/her out and sign in a new client {Environment.NewLine}"); messageBoard.Log(TheClinic.SignInNewClient(ClientGenerator.GenerateRandomClient(TheClinic))); } headerMessageBoard.Value = simState.title; commandBox.Value = simState.FillCommandBox(); while (input.HasInput) { string command = input.Consume(); simState.HandleInput(command, this); } messageBoard.Log(""); }
private void Start() { _clientGenerator = GetComponent <ClientGenerator>(); if (_clientGenerator == null) { Debug.LogError("Error: No Component 'ClientGenerator' were found on gameObject '" + gameObject.name + "'. Could not continue."); } else { _clientSpawnerCoroutine = null; PlayerTime.Instance.OnTimerFinish += StopSpawningClients; ClientSlotManager.Instance.InitSlots(); _clientsList = _clientGenerator.GenerateFullLevelClients(_maxClients); _isClientsInfinite = true; StartSpawningClients(); } }
protected override async Task <bool> Compile( string path, Configuration config, ClientGenerator generator) { IReadOnlyList <HCError> validationErrors = generator.Validate(); if (validationErrors.Count > 0) { WriteErrors(validationErrors); return(false); } await generator.BuildAsync(); return(true); }
static async Task Main(string[] args) { await ClientGenerator.Run(Secrets.NightscoutSiteURI, GetTargetPath()); Console.WriteLine("Initializing Contour Next Link..."); var mgr = new CNL24DeviceManager(); var device = await mgr.Initialize(); if (device == null) { Console.WriteLine($"Device not found. Is it connected?"); return; } Console.WriteLine($"DeviceId = {device.DeviceId}"); Console.ReadKey(); }
protected override async Task <bool> Compile( GenerateCommandContext context, string path, Configuration config, ClientGenerator generator, IReadOnlyList <DocumentInfo> documents, ICollection <HCError> errors) { string hashFile = FileSystem.CombinePath( path, WellKnownDirectories.Generated, WellKnownFiles.Hash); if (await SkipCompileAsync(path, hashFile, documents, context.Force)) { return(true); } generator.ModifyOptions(o => { o.LanguageVersion = context.Language; o.EnableDISupport = context.DISupport; }); generator.SetNamespace(context.Namespace); IReadOnlyList <HCError> validationErrors = generator.Validate(); if (validationErrors.Count > 0) { foreach (HCError error in validationErrors) { errors.Add(error); } return(false); } await generator.BuildAsync(); await File.WriteAllTextAsync(hashFile, CreateHash(documents)); return(true); }
protected override Task <bool> Compile( CompileCommandContext context, string path, Configuration config, ClientGenerator generator, IReadOnlyList <DocumentInfo> documents, ICollection <HCError> errors) { IReadOnlyList <HCError> validationErrors = generator.Validate(); if (validationErrors.Count > 0) { foreach (HCError error in validationErrors) { errors.Add(error); } return(Task.FromResult(false)); } return(Task.FromResult(true)); }
protected override async Task <bool> Compile( string path, IReadOnlyList <DocumentInfo> documents, Configuration config, ClientGenerator generator) { string hashFile = IOPath.Combine( path, WellKnownDirectories.Generated, WellKnownFiles.Hash); if (await SkipCompileAsync(path, hashFile, documents)) { return(true); } if (Enum.TryParse(LanguageVersion, true, out LanguageVersion version)) { generator.ModifyOptions(o => o.LanguageVersion = version); } generator.ModifyOptions(o => o.EnableDISupport = DISupport); if (Namespace is { })
protected override async Task <bool> Compile( string path, Configuration config, ClientGenerator generator) { if (Enum.TryParse(LanguageVersion, true, out LanguageVersion version)) { generator.ModifyOptions(o => o.LanguageVersion = version); } generator.ModifyOptions(o => o.EnableDISupport = DISupport); IReadOnlyList <HCError> validationErrors = generator.Validate(); if (validationErrors.Count > 0) { WriteErrors(validationErrors); return(false); } await generator.BuildAsync(); return(true); }
IEnumerator MeetTheClient(ClientGenerator clientToSurround) { foreach (GameObject w***e in listOfWhores) { WhoreGenerator whoreGen = w***e.GetComponent <WhoreGenerator> (); if (whoreGen.isOccupied == false) { w***e.GetComponent <CharacterMover> ().MoveToTarget(clientToSurround); if (whoreGen.thisWhoreButton == null) { GameObject buttonToSpawn = Instantiate(buttonPrefab, transform.position, transform.rotation); buttonToSpawn.transform.SetParent(whereToSpawnButtons.transform); buttonToSpawn.GetComponent <WhoreUIButton> ().AssignWhore(w***e); yield return(null); } else if (whoreGen.thisWhoreButton != null) { whoreGen.thisWhoreButton.SetActive(true); yield return(null); } yield return(null); } } }
public Template(Platform platform, string fileName, string workingDirectory, bool withPubKey = false) { _fileName = Guard.NotNullOrEmpty(fileName, nameof(fileName)); _workingDirectory = Guard.NotNullOrEmpty(workingDirectory, nameof(workingDirectory)); ClientGenerator.CreateClient(platform, _fileName, withPubKey); }
public void GenerateAssembly() { var builder = new ClientGenerator(); builder.CreateType<ITestInterface>(); builder.GenerateAssembly(); }
public void Load(BinaryFormatter formatter, FileStream stream) { // NOTE: Loading clients foreach (Client client in player.clients) { Destroy(client.gameObject); } player.clients.Clear(); int clientsCount = (int)formatter.Deserialize(stream); ClientGenerator generator = FindObjectOfType <ClientGenerator>(); for (int i = 0; i < clientsCount; i++) { string prefabName = (string)formatter.Deserialize(stream); Client clientPrefab = PrefabStorage.Instance.GetClientByName(prefabName); Client client = Instantiate(clientPrefab); client.Load(formatter, stream); client.prefabName = prefabName; player.AddClient(client); ClientData clientData = (ClientData)formatter.Deserialize(stream); client.clientData = clientData; } // NOTE: Loading tables foreach (Table table in player.tables) { Destroy(table.gameObject); } int tablesCount = (int)formatter.Deserialize(stream); player.tables.Clear(); for (int i = 0; i < tablesCount; i++) { string prefabName = (string)formatter.Deserialize(stream); Table tablePrefab = PrefabStorage.Instance.GetTableByName(prefabName); Table table = Instantiate(tablePrefab); table.Load(formatter, stream); table.prefabName = prefabName; player.tables.Add(table); TableData tableData = (TableData)formatter.Deserialize(stream); table.tableData = tableData; } // NOTE: Loading hookahs foreach (Hookah hookah in player.hookahs) { Destroy(hookah.gameObject); } int hookahsCount = (int)formatter.Deserialize(stream); player.hookahs.Clear(); for (int i = 0; i < hookahsCount; i++) { string prefabName = (string)formatter.Deserialize(stream); Hookah hookahPrefab = PrefabStorage.Instance.GetHookahByName(prefabName); Hookah hookah = Instantiate(hookahPrefab); hookah.Load(formatter, stream); hookah.prefabName = prefabName; player.hookahs.Add(hookah); } // NOTE: Loading hookah makers foreach (HookahMaker worker in player.workers) { Destroy(worker.gameObject); } int workersCount = (int)formatter.Deserialize(stream); player.workers.Clear(); for (int i = 0; i < workersCount; i++) { string prefabName = (string)formatter.Deserialize(stream); HookahMaker hookahMakerPrefab = PrefabStorage.Instance.GetHookahMakerByName(prefabName); HookahMaker worker = Instantiate(hookahMakerPrefab); worker.Load(formatter, stream); worker.prefabName = prefabName; player.workers.Add(worker); HookahMakerData hookahMakerData = (HookahMakerData)formatter.Deserialize(stream); worker.hookahMakerData = hookahMakerData; } RecreateClientLinks(formatter, stream); RecreateTableLinks(formatter, stream); RecreateHookahMakerLinks(formatter, stream); }
public void SurroundClient(ClientGenerator clientToSurround) { StartCoroutine(MeetTheClient(clientToSurround)); }
public ManualRemoteMathOperationsClient(ClientGenerator clientGenerator) { _clientGenerator = clientGenerator; _client = clientGenerator(); }