Example #1
0
        public TestLocalRead(uint assetDataSize)
        {
            _dataSize = assetDataSize;

            ChattelCleanup.CleanLocalStorageFolder(LOCAL_STORAGE_DIR_INFO);

            ChattelCleanup.CreateLocalStorageFolder(LOCAL_STORAGE_DIR_INFO);
            var config = new ChattelConfiguration(LOCAL_STORAGE_DIR_INFO.FullName);

            _reader = new ChattelReader(config);

            ChattelCleanup.CreateLocalStorageEntry(LOCAL_STORAGE_DIR_INFO, new InWorldz.Data.Assets.Stratus.StratusAsset {
                Id   = _knownAssetId = Guid.NewGuid(),
                Name = "Adama",
                Data = new byte[_dataSize],
            });
        }
Example #2
0
        private bool disposedValue;         // To detect redundant calls

        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    // dispose managed state (managed objects).
                    _reader = null;
                    ChattelCleanup.CleanLocalStorageFolder(LOCAL_STORAGE_DIR_INFO);
                }

                // free unmanaged resources (unmanaged objects) and override a finalizer below.
                // set large fields to null.

                disposedValue = true;
            }
        }
Example #3
0
        public TestMockRead(uint assetDataSize)
        {
            _dataSize = assetDataSize;

            ChattelCleanup.CreateLocalStorageFolder(LOCAL_STORAGE_DIR_INFO);
            var localStorage = Substitute.For <IChattelLocalStorage>();
            var config       = new ChattelConfiguration(LOCAL_STORAGE_DIR_INFO.FullName);

            _reader = new ChattelReader(config, localStorage);

            _knownAssetId = Guid.NewGuid();
            localStorage
            .TryGetAsset(_knownAssetId, out var junk)
            .Returns(x => {
                x[1] = new InWorldz.Data.Assets.Stratus.StratusAsset {
                    Id   = _knownAssetId,
                    Name = "Adama",
                    Data = new byte[_dataSize],
                };
                return(true);
            })
            ;
        }