Exemplo n.º 1
0
        public void FindMongoEvents()
        {
            bool func(MongoEvent d) => d.ShortDescription == "ShortDescription" && d.Description == "TestDescription";

            MongoEventRepository mongoEventRepository = new MongoEventRepository(db);

            Assert.That(mongoEventRepository.Find(func) != null);
        }
Exemplo n.º 2
0
        [Test]//works but i dont know why it cant pass
        public void GetMongoElement()
        {
            bool func(MongoEvent d) => d.ShortDescription == "ShortDescription" && d.Description == "TestDescription";

            var        mongoEventRepository = new MongoEventRepository(db);
            MongoEvent k = mongoEventRepository.Find(func).First();
            MongoEvent e = mongoEventRepository.Get(k.Id);

            Assert.That(k == e);
        }
Exemplo n.º 3
0
        public void DeleteMongoEvent()
        {
            bool func(MongoEvent d) => d.ShortDescription == "ShortDescription" && d.Description == "TestDescription2";

            MongoEventRepository mongoEventRepository = new MongoEventRepository(db);

            mongoEventRepository.Create(new MongoEvent {
                Description = "TestDescription2", ShortDescription = "ShortDescription", Name = "TestBAne"
            });
            mongoEventRepository.Delete(mongoEventRepository.Find(func).First().Id);
            var ex = Assert.Throws <InvalidOperationException>(() => mongoEventRepository.Find(func).First());

            Assert.That(ex.Message, Is.EqualTo("Последовательность не содержит элементов"));
        }
Exemplo n.º 4
0
        public void CreateMongoEvent()
        {
            bool func(MongoEvent d) => d.ShortDescription == "ShortDescription" && d.Description == "TestDescription";

            MongoEventRepository mongoEventRepository = new MongoEventRepository(db);

            mongoEventRepository.Create(new MongoEvent {
                Description = "TestDescription", ShortDescription = "ShortDescription", Name = "TestBAne", Location = new Vectord2D {
                    X = 54.3M, Y = 45.3M
                }
            });
            var k = mongoEventRepository.Find(func).First();

            Assert.That(k != null);
        }