public void The_Collection_class_does_not_expose_it()
        {
            var propertyInfo = CollectionInterface.GetProperty(_structuralProperty.Name, PermissiveBindingFlags);

            propertyInfo
            .Should().BeNull();
        }
        public void The_Collection_interface_is_attributed_with_LowerCaseProperty()
        {
            var lowerCasePropertyType = typeof(LowerCasePropertyAttribute);

            CollectionInterface.GetCustomAttribute(lowerCasePropertyType)
            .Should().NotBeNull("Because this is used to manage casing when interacting with ODataLib");
        }
        public void The_Collection_interface_does_not_expose_it()
        {
            var propertyInfo = CollectionInterface.GetProperty(_structuralProperty.Name, PermissiveBindingFlags);

            propertyInfo
            .Should().BeNull("Because you cannot independently fetch a complex type.");
        }
 public void The_Collection_interface_exposes_an_ExecuteAsync_method()
 {
     CollectionInterface.Should().HaveMethod(
         CSharpAccessModifiers.Public,
         typeof(Task <>).MakeGenericType(typeof(IPagedCollection <>).MakeGenericType(ConcreteInterface)),
         "ExecuteAsync", new Type[] { },
         "Because it allows executing the query.");
 }
Exemple #5
0
 public void The_Collection_interface_exposes_the_method()
 {
     CollectionInterface.Should().HaveMethod(
         CSharpAccessModifiers.Public,
         _expectedReturnType,
         _expectedMethodName,
         _expectedMethodParameters);
 }
Exemple #6
0
 public void The_Collection_interface_exposes_a_GetById_Indexer_for_full_key()
 {
     CollectionInterface.Should().HaveIndexer(
         CSharpAccessModifiers.Public,
         null,
         FetcherInterface,
         GetKeyTypes(),
         "Because it allows retrieving an instance by key");
 }
 public void The_Collection_interface_exposes_an_AddAsync_method()
 {
     CollectionInterface.Should()
     .HaveMethod(
         CSharpAccessModifiers.Public,
         typeof(Task), "Add" + Class.Name + "Async",
         new[] { ConcreteInterface, typeof(bool) },
         "Because it allows adding elements to the Entity Set.");
 }
 public void The_Collection_interface_exposes_a_GetById_method()
 {
     CollectionInterface.Should().HaveMethod(
         CSharpAccessModifiers.Public,
         FetcherInterface,
         "GetById",
         GetKeyPropertyTypes(),
         "Because it allows retrieving an instance by key");
 }
 public void The_Collection_interface_implements_IReadOnlyQueryableSetBaseofT()
 {
     CollectionInterface
     .Should().Implement(
         typeof(IReadOnlyQueryableSetBase <>).MakeGenericType(ConcreteInterface),
         "Because it implements IReadOnlyQueryableSetBase<T> which empowers it" +
         "with Linq expressions like Where, OrderBy, Expand, Select," +
         "Skip, and Take.");
 }
Exemple #10
0
 public void It_has_a_DeleteAsync_method()
 {
     CollectionInterface.Should().HaveMethod(
         CSharpAccessModifiers.Public,
         false,
         typeof(Task),
         "DeleteAsync",
         new System.Type[] { ConcreteInterface, typeof(bool) },
         "Because it allows deleting entities.");
 }
        public Given_an_OdcmClass_Entity_Collection_ExecuteAsync_Method()
        {
            Init(null, true);

            _executeAsyncMethod = CollectionInterface.GetMethod("ExecuteAsync",
                                                                PermissiveBindingFlags,
                                                                null,
                                                                new Type[0],
                                                                null);
        }
 public void It_has_a_CountAsync_method()
 {
     CollectionInterface.Should()
     .HaveMethod(
         CSharpAccessModifiers.Public,
         typeof(Task <long>),
         "CountAsync",
         new Type[0],
         "Because it allows adding elements to the Entity Set.");
 }
Exemple #13
0
 public void It_has_an_RemoveLinkAsync_method()
 {
     CollectionInterface.Should().HaveMethod(
         CSharpAccessModifiers.Public,
         false,
         typeof(Task),
         "RemoveLinkAsync",
         new System.Type[] { typeof(object), ConcreteInterface, typeof(bool) },
         "Because it allows deleting relationship between entities.");
 }
Exemple #14
0
        public Given_an_OdcmClass_Entity_Collection_GetById_Method()
        {
            base.Init();

            _getByIdMethod = CollectionInterface
                             .GetMethod(
                "GetById",
                ConcreteType.GetKeyProperties()
                .Select(p => p.PropertyType)
                .ToArray());
        }
        public Given_an_OdcmClass_Entity_Collection_GetById_Indexer()
        {
            base.Init();

            _getByIdIndexer = CollectionInterface.GetProperty("Item",
                                                              PermissiveBindingFlags,
                                                              null,
                                                              FetcherInterface,
                                                              ConcreteType.GetKeyProperties()
                                                              .Select(p => p.PropertyType)
                                                              .ToArray(), null);
        }
        public Given_an_OdcmClass_Entity_Collection_AddAsync_Method()
        {
            Init(null, true);

            _addAsyncMethod = CollectionInterface.GetMethod("Add" + Class.Name + "Async",
                                                            PermissiveBindingFlags,
                                                            null,
                                                            new[] { ConcreteInterface, typeof(bool) },
                                                            null);

            _entity = new object();

            _itemToAdd = ConstructConcreteInstance();

            _entityName = Any.AlphanumericString(1);

            _path = Any.String() + "/" + _entityName;

            _dscwMock = new Mock <DataServiceContextWrapper>(MockBehavior.Strict);

            _saveChangesAsyncReturnValue = null;

            ConfigureCollectionInstance();
        }
 public void The_Collection_interface_does_not_expose_it()
 {
     CollectionInterface.Should().NotHaveProperty(_navigationProperty.Name);
 }
 public void The_Collection_interface_does_not_expose_the_method()
 {
     CollectionInterface.Should().NotHaveMethod(_method.Name);
 }
 public void When_it_is_an_instance_property_then_the_Collection_interface_does_not_expose_it()
 {
     CollectionInterface.Should().NotHaveProperty(_structuralInstanceProperty.Name);
 }