コード例 #1
0
        public void BackwardProcessing_isCorrect()
        {
            // Arrange
            var expectedFactSet = new HashSet <Fact>
            {
                new Fact(SocketDomain.NumberOfPositions, 60),
                new Fact(SocketDomain.NumberOfContacts, 120),
                new Fact(SocketDomain.SizeLength, 0.0145f),
                new Fact(SocketDomain.MountingStyle, "Through Hole"),
                new Fact(SocketDomain.Color, "Natural"),
                new Fact(SocketDomain.SizeWidth, 0.0034f),
                new Fact(SocketDomain.SizeHeight, 0.00415f),
                new Fact(SocketDomain.SizeDiameter, 0.015f),
                new Fact(SocketDomain.HousingMaterial, "Thermoplastic"),
                new Fact(SocketDomain.HousingColor, "Natural"),
                new Fact(SocketDomain.Material, "Plastic"),
                new Fact(SocketDomain.ContactMaterial, "Phosphor Bronze"),
                new Fact(SocketDomain.ContactPlating, "Gold"),
                new Fact(SocketDomain.PinPitch, 0.00127f),
                new Fact(SocketDomain.Orientation, "Vertical"),
                new Fact(SocketDomain.NumberOfRows, 2),
                new Fact(SocketDomain.Gender, "Female")
            };

            const string socketName = "5145167-4";

            // Act
            var factSet = _productionProcessor.BackProcessing(socketName);

            // Assert
            Assert.Equal(expectedFactSet, factSet.Facts);
        }
コード例 #2
0
        public override Task <CustomSocket> FindSocketByIdentity(CustomSocketIdentity request, ServerCallContext context)
        {
            DebugWrite($"RpcCall 'FindSocketByIdentity': '{request}' from {context.Peer}");

            try
            {
                var factSet = _productionProcessor.BackProcessing(request.SocketName);
                return(Task.FromResult(FactSetToSocket(factSet)));
            }
            catch (Exception exception)
            {
                if (exception is EntityNotFoundException)
                {
                    throw new RpcException(new Status(StatusCode.NotFound, exception.Message));
                }
                throw new RpcException(new Status(StatusCode.Aborted, "BackProcessing throws unhandled exception"));
            }
        }