public void GivenAMongoMessageDataRepository_WhenGettingMessageData() { var db = new MongoClient().GetDatabase("messagedatastoretests"); _bucket = new GridFSBucket(db); var fixture = new Fixture(); _expected = fixture.Create<byte[]>(); _uri = fixture.Create<Uri>(); var objectId = SeedBucket(_expected).GetAwaiter().GetResult(); _resolver = new Mock<IMongoMessageUriResolver>(); _resolver.Setup(m => m.Resolve(_uri)).Returns(objectId); var nameCreator = new Mock<IFileNameCreator>(); nameCreator.Setup(m => m.CreateFileName()).Returns(fixture.Create<string>()); var sut = new MongoMessageDataRepository(_resolver.Object, _bucket, nameCreator.Object); _result = sut.Get(_uri).GetAwaiter().GetResult(); }
public void GivenAMongoMessageDataRepository_WhenGettingMessageData() { var db = new MongoClient().GetDatabase("messagedatastoretests"); _bucket = new GridFSBucket(db); var fixture = new Fixture(); _expected = fixture.Create <byte[]>(); _uri = fixture.Create <Uri>(); var objectId = SeedBucket(_expected).GetAwaiter().GetResult(); _resolver = new Mock <IMongoMessageUriResolver>(); _resolver.Setup(m => m.Resolve(_uri)).Returns(objectId); var nameCreator = new Mock <IFileNameCreator>(); nameCreator.Setup(m => m.CreateFileName()).Returns(fixture.Create <string>()); var sut = new MongoMessageDataRepository(_resolver.Object, _bucket, nameCreator.Object); _result = sut.Get(_uri).GetAwaiter().GetResult(); }