public void Returns_null_if_any_value_in_the_given_buffer_is_null() { var keyPropMock = new Mock <IProperty>(); keyPropMock.Setup(m => m.Index).Returns(0); var nonKeyPart1Mock = new Mock <IProperty>(); nonKeyPart1Mock.Setup(m => m.Index).Returns(1); var nonKeyPart2Mock = new Mock <IProperty>(); nonKeyPart2Mock.Setup(m => m.Index).Returns(2); var typeMock = new Mock <IEntityType>(); typeMock.Setup(m => m.GetKey().Properties).Returns(new[] { keyPropMock.Object }); var random = new Random(); var key = new CompositeEntityKeyFactory().Create( typeMock.Object, new[] { nonKeyPart2Mock.Object, nonKeyPart1Mock.Object }, new ObjectArrayValueReader(new object[] { 7, null, random })); Assert.Null(key); }
public void Returns_null_if_any_value_in_the_given_buffer_is_null() { var model = BuildModel(); var type = model.GetEntityType(typeof(Banana)); var random = new Random(); var key = new CompositeEntityKeyFactory().Create( type, new[] { type.GetProperty("P6"), type.GetProperty("P5") }, new ObjectArrayValueReader(new object[] { 7, "Ate", random, 77, null, random })); Assert.Equal(EntityKey.NullEntityKey, key); }