Ejemplo n.º 1
0
        private EntityObjectDataLoaderFactory CreateSut()
        {
            var bindingsBuilder = new EntityObjectDataLoader.BindingsBuilder()
                                  .Add <TestModelDataLoader>();

            return(new EntityObjectDataLoaderFactory(bindingsBuilder.Build()));
        }
        private EntityObjectDataLoaderFactory CreateSut()
        {
            var bindingsBuilder = new EntityObjectDataLoader.BindingsBuilder()
                                    .Add<TestModelDataLoader>();

            return new EntityObjectDataLoaderFactory(bindingsBuilder.Build());
        }
Ejemplo n.º 3
0
        public void Build_EmptyBindings_ShouldReturnEmptyBindings()
        {
            // Setup
            var sut = new EntityObjectDataLoader.BindingsBuilder();

            // Exercise
            var bindings = sut.Build();

            // Verify
            Assert.True(!bindings.Any(), "Bindings count should be 0");
        }
        public void Build_EmptyBindings_ShouldReturnEmptyBindings()
        {
            // Setup
            var sut = new EntityObjectDataLoader.BindingsBuilder();

            // Exercise
            var bindings = sut.Build();

            // Verify
            Assert.True(!bindings.Any(), "Bindings count should be 0");
        }
Ejemplo n.º 5
0
        public void AddOfTEntityDataLoader_CustomTableName_ShouldContainKeyAndValue()
        {
            // Setup
            var sut = new EntityObjectDataLoader.BindingsBuilder();

            var testModelDataLoaderType = typeof(TestModelDataLoader);
            var expectedKey             = "TestModel";
            var expectedValue           = string.Format("{0}, {1}", testModelDataLoaderType.FullName, testModelDataLoaderType.Assembly.FullName);

            // Exercise
            sut.Add <TestModelDataLoader>(expectedKey);

            var actual = sut.Build();

            // Verify
            Assert.Contains(actual, (kv) => kv.Key == expectedKey && kv.Value == expectedValue);
        }
        public void AddOfTEntityDataLoader_CustomTableName_ShouldContainKeyAndValue()
        {
            // Setup
            var sut = new EntityObjectDataLoader.BindingsBuilder();

            var testModelDataLoaderType = typeof(TestModelDataLoader);
            var expectedKey = "TestModel";
            var expectedValue = string.Format("{0}, {1}", testModelDataLoaderType.FullName, testModelDataLoaderType.Assembly.FullName);

            // Exercise
            sut.Add<TestModelDataLoader>(expectedKey);

            var actual = sut.Build();

            // Verify
            Assert.Contains(actual, (kv) => kv.Key == expectedKey && kv.Value == expectedValue);
        }
        public void GetArgument_ShouldBeEqualToExpectedBindings()
        {
            // Setup
            EntityObjectDataLoader.BindingsBuilder expectedBindings = null;

            var sut = new EntityObjectDataLoader(bindings => {
                bindings.Add <TestModelDataLoader>();
                expectedBindings = bindings;
            });

            var expected = Newtonsoft.Json.JsonConvert.SerializeObject(expectedBindings.Build());

            // Exercise
            var actual = sut.Argument;

            // Verify outcome
            Assert.Equal(expected, actual);
        }