コード例 #1
0
    public MutateJob QueueJobMutate(uint seed, float mutateRate)
    {
        var job = new MutateJob()
        {
            Seed       = seed,
            MutateRate = mutateRate,
            Layer0     = this.Layer0,
            Layer1     = this.Layer1,
            Layer2     = this.Layer2,
            bias0      = this.bias0,
            bias1      = this.bias1,
            bias2      = this.bias2,
            weights10  = this.weights10,
            weights21  = this.weights21,
        };

        return(job);
    }
コード例 #2
0
        public async Task GetMutateJobAsync2()
        {
            Mock <MutateJobService.MutateJobServiceClient> mockGrpcClient = new Mock <MutateJobService.MutateJobServiceClient>(MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient())
            .Returns(new Mock <Operations.OperationsClient>().Object);
            GetMutateJobRequest request = new GetMutateJobRequest
            {
                ResourceName = new MutateJobName("[CUSTOMER]", "[MUTATE_JOB]").ToString(),
            };
            MutateJob expectedResponse = new MutateJob
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetMutateJobAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <MutateJob>(Task.FromResult(expectedResponse), null, null, null, null));
            MutateJobServiceClient client = new MutateJobServiceClientImpl(mockGrpcClient.Object, null);
            MutateJob response            = await client.GetMutateJobAsync(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #3
0
        public void GetMutateJob()
        {
            Mock <MutateJobService.MutateJobServiceClient> mockGrpcClient = new Mock <MutateJobService.MutateJobServiceClient>(MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient())
            .Returns(new Mock <Operations.OperationsClient>().Object);
            GetMutateJobRequest expectedRequest = new GetMutateJobRequest
            {
                ResourceName = new MutateJobName("[CUSTOMER]", "[MUTATE_JOB]").ToString(),
            };
            MutateJob expectedResponse = new MutateJob
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetMutateJob(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            MutateJobServiceClient client   = new MutateJobServiceClientImpl(mockGrpcClient.Object, null);
            string    formattedResourceName = new MutateJobName("[CUSTOMER]", "[MUTATE_JOB]").ToString();
            MutateJob response = client.GetMutateJob(formattedResourceName);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }