Esempio n. 1
0
        public void AddCommand_delegates()
        {
            var sqlGenerator = new Mock <ISqlGenerator>().Object;
            var factory      = new TestModificationCommandBatchFactory(sqlGenerator);

            var modificationCommandBatchMock = new Mock <ModificationCommandBatch>();
            var mockModificationCommand      = new Mock <ModificationCommand>().Object;

            factory.AddCommand(modificationCommandBatchMock.Object, mockModificationCommand);

            modificationCommandBatchMock.Verify(mcb => mcb.AddCommand(mockModificationCommand));
        }
Esempio n. 2
0
        public void Create_returns_new_instances()
        {
            var factory = new TestModificationCommandBatchFactory(
                new Mock <SqlGenerator>().Object);

            var firstBatch  = factory.Create();
            var secondBatch = factory.Create();

            Assert.NotNull(firstBatch);
            Assert.NotNull(secondBatch);
            Assert.NotSame(firstBatch, secondBatch);
        }
        public void Create_returns_new_instances()
        {
            var factory = new TestModificationCommandBatchFactory(
                Mock.Of <ISqlGenerator>());

            var options = new Mock <IEntityOptions>().Object;
            var metadataExtensionProvider = Mock.Of <IRelationalMetadataExtensionProvider>();

            var firstBatch  = factory.Create(options, metadataExtensionProvider);
            var secondBatch = factory.Create(options, metadataExtensionProvider);

            Assert.NotNull(firstBatch);
            Assert.NotNull(secondBatch);
            Assert.NotSame(firstBatch, secondBatch);
        }
        public void Create_returns_new_instances()
        {
            var factory = new TestModificationCommandBatchFactory(
                Mock.Of<IUpdateSqlGenerator>());

            var options = new Mock<IDbContextOptions>().Object;
            var metadataExtensionProvider = Mock.Of<IRelationalMetadataExtensionProvider>();

            var firstBatch = factory.Create(options, metadataExtensionProvider);
            var secondBatch = factory.Create(options, metadataExtensionProvider);

            Assert.NotNull(firstBatch);
            Assert.NotNull(secondBatch);
            Assert.NotSame(firstBatch, secondBatch);
        }
        public void AddCommand_delegates()
        {
            var sqlGenerator = new Mock <ISqlGenerator>().Object;
            var factory      = new TestModificationCommandBatchFactory(sqlGenerator);

            var modificationCommandBatchMock = new Mock <ModificationCommandBatch>(sqlGenerator);
            var mockModificationCommand      = new Mock <ModificationCommand>(
                "T",
                "S",
                new ParameterNameGenerator(),
                (Func <IProperty, IRelationalPropertyExtensions>)(p => p.Relational()),
                Mock.Of <IRelationalValueBufferFactoryFactory>()).Object;

            factory.AddCommand(modificationCommandBatchMock.Object, mockModificationCommand);

            modificationCommandBatchMock.Verify(mcb => mcb.AddCommand(mockModificationCommand));
        }
        public void AddCommand_delegates()
        {
            var sqlGenerator = new Mock<IUpdateSqlGenerator>().Object;
            var factory = new TestModificationCommandBatchFactory(sqlGenerator);

            var modificationCommandBatchMock = new Mock<ModificationCommandBatch>(sqlGenerator);
            var mockModificationCommand = new Mock<ModificationCommand>(
                "T",
                "S",
                new ParameterNameGenerator(),
                (Func<IProperty, IRelationalPropertyAnnotations>)(p => p.TestProvider()),
                Mock.Of<IRelationalValueBufferFactoryFactory>()).Object;

            factory.AddCommand(modificationCommandBatchMock.Object, mockModificationCommand);

            modificationCommandBatchMock.Verify(mcb => mcb.AddCommand(mockModificationCommand));
        }