Exemple #1
0
        public void Returns_null_if_any_value_in_the_entry_properties_are_the_set_sentinel()
        {
            var model        = BuildModel();
            var type         = model.GetEntityType(typeof(SentinelBanana));
            var stateManager = TestHelpers.Instance.CreateContextServices(model).GetRequiredService <IStateManager>();

            var entity = new SentinelBanana {
                P1 = 7, P2 = "Ate", P3 = new Random()
            };

            var entry = stateManager.GetOrCreateEntry(entity);

            Assert.Equal(
                EntityKey.InvalidEntityKey,
                new CompositeEntityKeyFactory(
                    type.GetPrimaryKey())
                .Create(type.GetPrimaryKey().Properties, entry));
        }
        public void Returns_null_if_any_value_in_the_entry_properties_are_the_set_sentinel()
        {
            var model = BuildModel();
            var type = model.GetEntityType(typeof(SentinelBanana));
            var stateManager = TestHelpers.Instance.CreateContextServices(model).GetRequiredService<IStateManager>();

            var entity = new SentinelBanana { P1 = 7, P2 = "Ate", P3 = new Random() };

            var entry = stateManager.GetOrCreateEntry(entity);

            Assert.Equal(
                EntityKey.InvalidEntityKey,
                new CompositeEntityKeyFactory(
                    type.GetPrimaryKey())
                    .Create(type.GetPrimaryKey().Properties, entry));
        }