public void GivenAMongoMessageUriResolver_WhenResolvingAnObjectId()
        {
            var objectId = ObjectId.GenerateNewId();
            _expected = new Uri(string.Format($"urn:mongodb:gridfs:{objectId}"));
            var sut = new MessageDataResolver();

            _result = sut.GetAddress(objectId);
        }
        public void GivenAMongoMessageUriResolver_WhenResolvingObjectIdFromUri()
        {
            _expected = ObjectId.GenerateNewId();
            var uri = new Uri(string.Format($"urn:mongodb:gridfs:{_expected}"));
            var sut = new MessageDataResolver();

            _result = sut.GetObjectId(uri);
        }
        public void GivenAMongoMessageUriResolver_WhenResolvingMalformedUris()
        {
            var sut = new MessageDataResolver();

            try
            {
                sut.GetObjectId(_uri);
            }
            catch (Exception ex)
            {
                _exception = ex;
            }
        }
        public void GivenAMongoMessageDataRepository_WhenPuttingMessageData()
        {
            var db = new MongoClient().GetDatabase("messagedatastoretests");
            _bucket = new GridFSBucket(db);

            _expectedData = Encoding.UTF8.GetBytes("This is a test message data block");

            _resolver = new MessageDataResolver();
            _nameCreator = new StaticFileNameGenerator();
            _filename = _nameCreator.GenerateFileName();

            IMessageDataRepository repository = new MongoDbMessageDataRepository(_resolver, _bucket, _nameCreator);

            using (var stream = new MemoryStream(_expectedData))
            {
                _actualUri = repository.Put(stream).GetAwaiter().GetResult();

            }
        }