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);
        }
Esempio n. 2
0
        void Caller()
        {
            DocumentsCollection collection = new DocumentsCollection();

            foreach (var item in collection)
            {
                Console.WriteLine(item.Name);
            }
        }
Esempio n. 3
0
        void Caller()
        {
            DocumentsCollection collection = new DocumentsCollection();

            collection.Add(new DocumentA());
            collection.Add(new DocumentB());

            collection.AcceptVisitor(new DocumentHistoryMakerVisitor());
        }
        public void AllEmptyTest()
        {
            // Arrange
            var storage    = Mock.Of <IDocumentStorage>();
            var serializer = new Mock <IDocumentSerializer>();
            var collection = new DocumentsCollection <Person>(REF, storage, serializer.Object);

            // Act
            var actual = collection.Documents;

            // Assert
            Assert.Empty(actual);
        }
        public void NewTest()
        {
            // Arrange
            var storage    = new Mock <IDocumentStorage>();
            var serializer = new Mock <IDocumentSerializer>();
            var collection = new DocumentsCollection <Person>(REF, storage.Object, serializer.Object);

            // Act
            var actual = collection.New();

            // Assert
            Assert.NotNull(actual);
        }
        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);
        }
Esempio n. 7
0
 void Caller()
 {
     DocumentsCollection col      = new DocumentsCollection();
     BaseDocument        docClone = (BaseDocument)col.ToList()[0].Clone();
 }