Пример #1
0
        public void ShouldHaveDefaultStateOnCreation()
        {
            _table = new WorksharingMonitorTable(_modelName);

            // check if table has any data
            var elements = _table.Table.Count(_ => true);

            Assert.IsTrue(elements > 0);
        }
Пример #2
0
        public void ShouldAddNewModelOpenedEvent()
        {
            _table = new WorksharingMonitorTable(_modelName);
            _table.AddModelOpenedEvent(_modelName);

            // check if table has any data
            var elem = _table.GetLastInserted();

            Assert.AreEqual(WorksharingEventType.ModelOpen, elem.EventType);
        }
Пример #3
0
        public void ShouldCreateNewTableForNewlyAddedModelOnInstantiation()
        {
            _table = new WorksharingMonitorTable(_modelName);

            var filter = new BsonDocument("name", _modelName);
            var dbs    = _table.Database.Database.ListCollections(new ListCollectionsOptions {
                Filter = filter
            });

            Assert.IsTrue(dbs.Any());
        }
Пример #4
0
        public void ShouldHaveGetLastInserted()
        {
            _table = new WorksharingMonitorTable(_modelName);
            var eventState = new UserClosedModelEvent(_user);

            _table.Table.InsertOne(eventState);

            // check if table has any data
            var elem          = _table.GetLastInserted();
            var datesAreEqual = elem.TimeCreated == eventState.TimeCreated;

            Assert.IsTrue(datesAreEqual);
        }
Пример #5
0
 public void ResetTable()
 {
     _table = new WorksharingMonitorTable(_modelName);
     _table.Database.Database.DropCollection(_modelName);
 }