Beispiel #1
0
        public void Venue_VenueServiceApi_UpsertStandardAttributeByTitle_IfNotSuccess_ThrowsApiException()
        {
            var attribute = new StandardAttribute {
                description = "desc", title = "title", intention = ""
            };

            executorMock
            .Setup(x => x.ExecuteApiWithWrappedResponse <StandardAttribute>(
                       It.IsAny <string>(),
                       It.IsAny <RequestMethod>(),
                       It.IsAny <object>(),
                       null,
                       null,
                       true))
            .Returns(() => new ApiResult <StandardAttribute>(
                         attribute,
                         TestHelper.GetFailedResponse(),
                         It.IsAny <ApiContext>(),
                         It.IsAny <Context>(),
                         It.IsAny <Request>()));

            Assert.Catch <ApiException>(() =>
            {
                var result = UpsertStandardAttributeByTitle(attribute);
            });

            executorMock.Verify(mock => mock.ExecuteApiWithWrappedResponse <StandardAttribute>(
                                    It.IsAny <string>(),
                                    It.IsAny <RequestMethod>(),
                                    It.IsAny <object>(),
                                    null,
                                    null,
                                    true), Times.Once);
        }
Beispiel #2
0
        public BufferObject SetAttributeData(StandardAttribute attribute, AttributeBuffer data, bool normalize)
        {
            var attrIndex = (uint)attribute;

            Bind();

            if (data == null)
            {
                Context.DisableVertexAttribArray(attrIndex);
                Disposer.Dispose(ref _attributeBuffers[attrIndex]);
                return(null);
            }

            BufferObject buffer;

            if (_attributeBuffers[attrIndex] == null)
            {
                buffer = new BufferObject(BufferObjectTypes.Vertex);
                _attributeBuffers[attrIndex] = buffer;
            }
            else
            {
                buffer = _attributeBuffers[attrIndex];
            }

            Context.EnableVertexAttribArray((uint)attribute);
            buffer.BufferData(data);
            Context.VertexAttribPointer(attrIndex, data.StructInLine, data.DataType, normalize, 0, 0);

            return(buffer);
        }
Beispiel #3
0
        public void Venue_VenueServiceApi_UpsertStandardAttributeByTitle_IfSuccess_ReturnsUpdated()
        {
            var attribute = new StandardAttribute {
                description = "desc", title = "title", intention = ""
            };

            executorMock
            .Setup(x => x.ExecuteApiWithWrappedResponse <StandardAttribute>(
                       It.IsAny <string>(),
                       It.IsAny <RequestMethod>(),
                       It.IsAny <object>(),
                       null,
                       null,
                       true))
            .Returns(() => new ApiResult <StandardAttribute>(
                         attribute,
                         TestHelper.GetSuccessResponse(),
                         It.IsAny <ApiContext>(),
                         It.IsAny <Context>(),
                         It.IsAny <Request>()));

            var result = UpsertStandardAttributeByTitle(attribute);

            executorMock.Verify(mock => mock.ExecuteApiWithWrappedResponse <StandardAttribute>(
                                    It.IsAny <string>(),
                                    It.IsAny <RequestMethod>(),
                                    It.IsAny <object>(),
                                    null,
                                    null,
                                    true), Times.Once);
            AssertExtension.SimplePropertyValuesAreEquals(attribute, result);
        }
Beispiel #4
0
        int GetStandardOffset(StandardAttribute attribute)
        {
            IntPtr pOffset = new IntPtr();

            vdkAttributeSet_GetOffsetOfStandardAttribute(ref set, attribute, pOffset);
            unsafe {
                return(*((int *)pOffset.ToPointer()));
            }
        }
Beispiel #5
0
        /// <summary>
        /// Upsert a standard attribute by its title.
        /// </summary>
        /// <returns>The updated standard attribute.</returns>
        public StandardAttribute UpsertStandardAttributeByTitle(StandardAttribute attribute)
        {
            var result = Executor.ExecuteApiWithWrappedResponse <StandardAttribute>(
                "v1/admin/attributes",
                RequestMethod.Patch,
                attribute);

            return(result.DataOrException);
        }
Beispiel #6
0
            public UInt32 ByteOffsetOf(StandardAttribute i)
            {
                IntPtr intPtr  = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(UInt32)));
                IntPtr selfPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(udAttributeSetInternal)));

                Marshal.StructureToPtr(this, selfPtr, false);
                udError code = udAttributeSet_GetOffsetOfStandardAttribute(selfPtr, i, intPtr);

                if (code != udError.udE_Success)
                {
                    throw new UDException(code);
                }
                UInt32 offset = Marshal.PtrToStructure <UInt32>(intPtr);

                Marshal.FreeHGlobal(intPtr);
                Marshal.FreeHGlobal(selfPtr);
                return(offset);
            }
Beispiel #7
0
 private static extern udError udAttribute_GetDescriptorOfStandardAttribute(StandardAttribute attribute, IntPtr /*udAttributeDescriptor * */ pDescriptor);
Beispiel #8
0
 private static extern udError udAttributeSet_GetOffsetOfStandardAttribute(IntPtr /*udAttributeSet * */ pAttributeSet, StandardAttribute attribute, IntPtr pOffset);
Beispiel #9
0
 private static extern udError vdkAttributeSet_GetOffsetOfStandardAttribute(ref udAttributeSet pAttributeSet, StandardAttribute attribute, IntPtr pOffset);
Beispiel #10
0
 private void BindAttributeLocation(StandardAttribute standardAttributeLocation, string attributeName)
 {
     Context.BindAttributeLocation(Handle, (int)standardAttributeLocation, attributeName);
 }