public void Ctor_NullColumnsDescription_ShouldThrowArgumentNullException()
        {
            // Setup
            IEntityDataLoader<object> entityDataLoader = new TestModelDataLoader();

            // Exercise 
            Action act = () => new EntityObjectDataLoaderWrapper(entityDataLoader, null);

            // Verify outcome
            var ex = Assert.Throws<ArgumentNullException>(act);
            Assert.Equal("columnsDescription", ex.ParamName);
        }
        public void Ctor_EmptyColumnsDescription_ShouldThrowArgumentException()
        {
            // Setup
            IEntityDataLoader<object> entityDataLoader = new TestModelDataLoader();
            IReadOnlyCollection<ColumnDescription> columnsDescription = new List<ColumnDescription>();

            // Exercise 
            Action act = () => new EntityObjectDataLoaderWrapper(entityDataLoader, columnsDescription);

            // Verify outcome
            var ex = Assert.Throws<ArgumentException>(act);
            Assert.Equal("columnsDescription", ex.ParamName);
        }
        public void Ctor_NullColumnsDescription_ShouldThrowArgumentNullException()
        {
            // Setup
            IEntityDataLoader <object> entityDataLoader = new TestModelDataLoader();

            // Exercise
            Action act = () => new EntityObjectDataLoaderWrapper(entityDataLoader, null);

            // Verify outcome
            var ex = Assert.Throws <ArgumentNullException>(act);

            Assert.Equal("columnsDescription", ex.ParamName);
        }
        public void Ctor_EmptyColumnsDescription_ShouldThrowArgumentException()
        {
            // Setup
            IEntityDataLoader <object> entityDataLoader = new TestModelDataLoader();
            IReadOnlyCollection <ColumnDescription> columnsDescription = new List <ColumnDescription>();

            // Exercise
            Action act = () => new EntityObjectDataLoaderWrapper(entityDataLoader, columnsDescription);

            // Verify outcome
            var ex = Assert.Throws <ArgumentException>(act);

            Assert.Equal("columnsDescription", ex.ParamName);
        }
        public void GetData_ShouldExpectedBeEqualToActual()
        {
            // Setup
            IEntityDataLoader <TestModel>           entityDataLoader   = new TestModelDataLoader();
            IReadOnlyCollection <ColumnDescription> columnsDescription = BuildTestModelTableDescription().Columns;

            var sut = new EntityObjectDataLoaderWrapper(entityDataLoader, columnsDescription);

            var expected = entityDataLoader.GetData().ToArray();

            // Exercise
            var actual = sut.GetData().ToArray();

            // Verify outcome
            AssertEqual(expected, actual);
        }
        public void GetData_TargetTypeNotContainsColumnDescription_ShouldThrowMissingPropertyException()
        {
            // Setup
            IEntityDataLoader <TestModel> entityDataLoader = new TestModelDataLoader();
            var expected = BuildTestModelTableDescriptionWithNonExistentColumn().Columns;
            IReadOnlyCollection <ColumnDescription> columnsDescription = expected;

            var sut = new EntityObjectDataLoaderWrapper(entityDataLoader, columnsDescription);

            // Exercise
            Action act = () => sut.GetData().ToArray();

            // Verify outcome
            var ex     = Assert.Throws <Bardock.UnitTesting.Data.EF.Effort.DataLoaders.EntityObjectDataLoaderWrapper.MissingPropertyException>(act);
            var actual = ex.ColumnsDescription;

            Assert.Equal(expected, actual);
        }
        public void GetData_ShouldExpectedBeEqualToActual()
        {
            // Setup
            IEntityDataLoader<TestModel> entityDataLoader = new TestModelDataLoader();
            IReadOnlyCollection<ColumnDescription> columnsDescription = BuildTestModelTableDescription().Columns;

            var sut = new EntityObjectDataLoaderWrapper(entityDataLoader, columnsDescription);

            var expected = entityDataLoader.GetData().ToArray();

            // Exercise
            var actual = sut.GetData().ToArray();

            // Verify outcome
            AssertEqual(expected, actual);
        }
        public void GetData_TargetTypeNotContainsColumnDescription_ShouldThrowMissingPropertyException()
        {
            // Setup
            IEntityDataLoader<TestModel> entityDataLoader = new TestModelDataLoader();
            var expected = BuildTestModelTableDescriptionWithNonExistentColumn().Columns;
            IReadOnlyCollection<ColumnDescription> columnsDescription = expected;

            var sut = new EntityObjectDataLoaderWrapper(entityDataLoader, columnsDescription);

            // Exercise
            Action act = () => sut.GetData().ToArray();

            // Verify outcome
            var ex = Assert.Throws<Bardock.UnitTesting.Data.EF.Effort.DataLoaders.EntityObjectDataLoaderWrapper.MissingPropertyException>(act);
            var actual = ex.ColumnsDescription;
            Assert.Equal(expected, actual);
        }