Exemplo n.º 1
0
        public void Static_TranslateColumnMap_calls_instance_method()
        {
            var typeUsageMock = new Mock <TypeUsage>();

            var expectedShaperFactory = new ShaperFactory <object>(
                0, Objects.MockHelper.CreateCoordinatorFactory <object>(),
                new Type[0], new bool[0], MergeOption.AppendOnly);

            var translatorMock = new Mock <Translator>();

            translatorMock.Setup(
                m => m.TranslateColumnMap <object>(
                    It.IsAny <ColumnMap>(), It.IsAny <MetadataWorkspace>(),
                    It.IsAny <SpanIndex>(), It.IsAny <MergeOption>(), It.IsAny <bool>(), It.IsAny <bool>())).Returns(expectedShaperFactory);

            var actualShaperFactory = Translator.TranslateColumnMap(
                translatorMock.Object, typeof(object),
                new ScalarColumnMap(typeUsageMock.Object, null, 0, 0), new MetadataWorkspace(),
                new SpanIndex(), MergeOption.AppendOnly, streaming: false, valueLayer: true);

            translatorMock.Verify(
                m => m.TranslateColumnMap <object>(
                    It.IsAny <ColumnMap>(), It.IsAny <MetadataWorkspace>(),
                    It.IsAny <SpanIndex>(), It.IsAny <MergeOption>(), false, true), Times.Once());
            Assert.Same(expectedShaperFactory, actualShaperFactory);
        }
Exemplo n.º 2
0
        public static Translator CreateTranslator <T>() where T : class
        {
            var shaperFactory = new ShaperFactory <T>(
                1,
                Objects.MockHelper.CreateCoordinatorFactory <object, T>(0, 0, 0, new CoordinatorFactory[0], new List <T>()),
                new Type[0], new bool[0], MergeOption.AppendOnly);

            var translatorMock = new Mock <Translator>();

            translatorMock.Setup(
                m => m.TranslateColumnMap <T>(It.IsAny <ColumnMap>(), It.IsAny <MetadataWorkspace>(),
                                              It.IsAny <SpanIndex>(), It.IsAny <MergeOption>(), It.IsAny <bool>(), It.IsAny <bool>())).Returns(shaperFactory);

            return(translatorMock.Object);
        }
Exemplo n.º 3
0
        public static Translator CreateRecordStateTranslator()
        {
            var shaperFactory = new ShaperFactory <RecordState>(
                2,
                Objects.MockHelper.CreateCoordinatorFactory <object, RecordState>(
                    0, 0, 0, new CoordinatorFactory[0], new List <RecordState>()),
                new Type[0], new bool[0], MergeOption.NoTracking);

            var translatorMock = new Mock <Translator>();

            translatorMock.Setup(
                m => m.TranslateColumnMap <RecordState>(It.IsAny <ColumnMap>(), It.IsAny <MetadataWorkspace>(),
                                                        It.IsAny <SpanIndex>(), It.IsAny <MergeOption>(), It.IsAny <bool>(), It.IsAny <bool>())).Returns(shaperFactory);

            return(translatorMock.Object);
        }