public void SingleAttributeProjectionTest() { Assert.Throws <ArgumentException>(() => _ = new SingleAttributeProjection("")); var p = new SingleAttributeProjection(); Assert.That(p.FactoryId, Is.EqualTo(FactoryIds.ProjectionDsFactoryId)); Assert.That(p.ClassId, Is.EqualTo(ProjectionDataSerializerHook.SingleAttribute)); p = new SingleAttributeProjection("attribute"); Assert.That(p.FactoryId, Is.EqualTo(FactoryIds.ProjectionDsFactoryId)); Assert.That(p.ClassId, Is.EqualTo(ProjectionDataSerializerHook.SingleAttribute)); Assert.Throws <ArgumentNullException>(() => p.WriteData(null)); Assert.Throws <ArgumentNullException>(() => p.ReadData(null)); using var output = new ByteArrayObjectDataOutput(256, null, Endianness.Unspecified); p.WriteData(output); using var input = new ByteArrayObjectDataInput(output.Buffer, null, Endianness.Unspecified); p = new SingleAttributeProjection(); p.ReadData(input); Assert.That(p.AttributePath, Is.EqualTo("attribute")); }
public void SingleAttributeProjectionTest() { Assert.Throws <ArgumentException>(() => _ = Hazelcast.Projection.Projections.SingleAttribute("")); var x = Hazelcast.Projection.Projections.SingleAttribute("attribute"); Assert.That(x, Is.InstanceOf <SingleAttributeProjection>()); var p = (SingleAttributeProjection)x; Assert.That(p.FactoryId, Is.EqualTo(FactoryIds.ProjectionDsFactoryId)); Assert.That(p.ClassId, Is.EqualTo(ProjectionDataSerializerHook.SingleAttribute)); Assert.Throws <ArgumentNullException>(() => p.WriteData(null)); Assert.Throws <ArgumentNullException>(() => p.ReadData(null)); using var output = new ObjectDataOutput(256, null, Endianness.BigEndian); p.WriteData(output); using var input = new ObjectDataInput(output.Buffer, null, Endianness.BigEndian); p = new SingleAttributeProjection(); p.ReadData(input); Assert.That(p.AttributePath, Is.EqualTo("attribute")); }