private void McOnDoWork(IServiceProvider serviceprovider, CancellationToken stopservicetoken)
        {
            var rabbit = serviceprovider.GetService <IMessageQueueClient>();

            Assert.IsNotNull(rabbit);
            Mc.Stop();
        }
        private void PublisherServiceOnDoWork(IServiceProvider serviceprovider, CancellationToken stopservicetoken)
        {
            var client = serviceprovider.GetService <IMessageQueueClient>();

            client.PublishMessage("Test", _originalContract);
            _publisherService.Stop();
        }
        private void RpcServiceOnDoWork(IServiceProvider serviceprovider, CancellationToken stopservicetoken)
        {
            var client = serviceprovider.GetService <IMessageQueueClient>();
            var t      = client.MakeRpcCallAsync <ReqContract, RespContract>(_originalContract, "Test").Result;

            _rpcService.Stop();
        }
Example #4
0
        private void McOnDoWork(IServiceProvider serviceprovider, CancellationToken stopservicetoken)
        {
            var clientService = serviceprovider.GetService <IClientService>();
            var client        = clientService.GetInstance <GreetingService.GreetingServiceClient>();

            Assert.IsNotNull(client);

            var reply = client.greetingNew(new GreetingEmpty());

            var client2 = serviceprovider.GetService <GreetingService.GreetingServiceClient>();

            Assert.IsNotNull(client2);

            Mc.Stop();
        }
        private void McOnDoWork(IServiceProvider serviceprovider, CancellationToken stopservicetoken)
        {
            var clientService = serviceprovider.GetService <IClientService>();
            var client        = clientService.GetInstance <ProxiM.ProxiMClient>();

            Assert.IsNotNull(client);

            Assert.DoesNotThrow(() =>
            {
                var tasks = new Task[10];
                for (var i = 0; i < tasks.Length; i++)
                {
                    tasks[i] = Task.Run(() =>
                    {
                        var rootPath = TestContext.CurrentContext.TestDirectory;
                        var well     = File.OpenRead(Path.Combine(rootPath, "files", "main_05.02.xlsx"));
                        var model    = File.OpenRead(Path.Combine(rootPath, "files", "sub_05.02.xlsx"));
                        var id       = Guid.NewGuid();
                        var reply    = client.Execute(new CalcRequest
                        {
                            Id           = ByteString.CopyFrom(id.ToByteArray()),
                            WellDataFile = ByteString.FromStream(well),
                            ModelFile    = ByteString.FromStream(model),
                        });

                        for (var index = 0; index < reply.Files.Count; index++)
                        {
                            var calcFile = reply.Files[index];
                            var file     = File.Open(Path.Combine(rootPath, $"out_{index}_{id}.xlsx"), FileMode.OpenOrCreate);
                            calcFile.Content.WriteTo(file);
                            file.Close();
                        }

                        Assert.NotNull(reply);
                    }, stopservicetoken);
                }

                Task.WaitAll(tasks);
            });

            Mc.Stop();
        }
 private void ReciverServiceOnDoWork(IServiceProvider serviceprovider, CancellationToken stopservicetoken)
 {
     // Ждем, что из DefaultHandlerMock будет снята защелка для продолжения выполнения теста
     ReciverSyncObject.Mrs.Wait(timeout: new TimeSpan(0, 0, 0, 1));
     _reciverService.Stop();
 }