Esempio n. 1
0
        public async Task <IDocumentCollection <T> > InitCollection <T>(string conn) where T : class, new()
        {
            var collection = new DocumentsCollection <T>(conn, _storage, _serializer);
            await collection.Init();

            return(collection);
        }
        public async void AllTest()
        {
            // Arrange
            var storage    = new Mock <IDocumentStorage>();
            var serializer = new Mock <IDocumentSerializer>();
            var collection = new DocumentsCollection <Person>(REF, storage.Object, serializer.Object);
            var people     = new string[3] {
                "Kirill", "Dima", "Kate"
            };

            // Act
            storage.Setup(i => i.Enumerate(REF)).Returns(Task.FromResult(people));
            await collection.Init();

            var actual = collection;

            // Assert
            Assert.Equal(people.Count(), actual.Documents.Length);
        }