Exemple #1
0
        public void Datastore_service_upsert_accepts_enumerable()
        {
            var mockContext   = new MockContext <IDatastoreService>();
            var datastoreMock = new DatastoreServiceMock(mockContext);

            datastoreMock.UpsertRange(new List <TestModel>());
            mockContext.Assert(f => f.UpsertRange(The <IEnumerable <TestModel> > .IsAnyValue));
        }
Exemple #2
0
        public void Datastore_service_upsert_accepts_entity()
        {
            var mockContext   = new MockContext <IDatastoreService>();
            var datastoreMock = new DatastoreServiceMock(mockContext);

            datastoreMock.Upsert(new TestModel());
            mockContext.Assert(f => f.Upsert(The <TestModel> .IsAnyValue));
        }
Exemple #3
0
        public void Datastore_service_delete_accepts_predicate()
        {
            var mockContext   = new MockContext <IDatastoreService>();
            var datastoreMock = new DatastoreServiceMock(mockContext);

            datastoreMock.Delete <TestModel>(x => true);
            mockContext.Assert(f => f.Delete(The <Func <TestModel, bool> > .IsAnyValue));
        }
Exemple #4
0
        public void Datastore_service_delete_accepts_entity_object()
        {
            var mockContext   = new MockContext <IDatastoreService>();
            var datastoreMock = new DatastoreServiceMock(mockContext);

            datastoreMock.Delete(new TestModel());
            mockContext.Assert(f => f.Delete(The <TestModel> .IsAnyValue));
        }
Exemple #5
0
        public void Datastore_service_gql_accepts_query_object()
        {
            var runQueryResponse = new RunQueryResponse();
            var mockContext      = new MockContext <IDatastoreService>();

            mockContext.Arrange(f => f.Gql(The <GqlQuery> .IsAnyValue)).Returns(runQueryResponse);
            var datastoreMock = new DatastoreServiceMock(mockContext);

            var response = datastoreMock.Gql(new GqlQuery());

            mockContext.Assert(f => f.Gql(The <GqlQuery> .IsAnyValue));
            Assert.Equal(runQueryResponse, response);
        }
Exemple #6
0
        public void Datastore_service_find_returns_queryable_interface()
        {
            var testQueryable = (IOrderedQueryable <TestModel>)GetQueryable();

            var mockContext = new MockContext <IDatastoreService>();

            mockContext.Arrange(f => f.Find <TestModel>()).Returns(testQueryable);

            var datastoreMock = new DatastoreServiceMock(mockContext);
            var result        = datastoreMock.Find <TestModel>();

            mockContext.Assert(f => f.Find <TestModel>(), Invoked.Once);
            Assert.Equal(testQueryable, result);
        }