public void Nonexisting_assets_should_throw_AssetNotFoundException() { const string asset = "test.ase"; var loaderServiceMock = new Mock<IAssetLoaderService>(); var fileLoaderMock = new Mock<IFileLoader>(); fileLoaderMock.Expect(l => l.GetStream(asset)).Returns( () => { return null; }); var contentManagerMock = new Mock<IContentManager>(); var loader = new AseLoader(loaderServiceMock.Object, fileLoaderMock.Object, contentManagerMock.Object); loader.ShouldThrowException<AssetNotFoundException>(()=>loader.Load(asset)); }
public void Nonexisting_assets_should_throw_AssetNotFoundException() { const string asset = "test.ase"; var loaderServiceMock = new Mock <IAssetLoaderService>(); var fileLoaderMock = new Mock <IFileLoader>(); fileLoaderMock.Expect(l => l.GetStream(asset)).Returns( () => { return(null); }); var contentManagerMock = new Mock <IContentManager>(); var loader = new AseLoader(loaderServiceMock.Object, fileLoaderMock.Object, contentManagerMock.Object); loader.ShouldThrowException <AssetNotFoundException>(() => loader.Load(asset)); }
public static Geometry[] LoadGeometryFromBytes(byte[] data) { const string asset = "test.ase"; var loaderServiceMock = new Mock<IAssetLoaderService>(); var fileLoaderMock = new Mock<IFileLoader>(); fileLoaderMock.Expect(l => l.GetStream(asset)).Returns( () => { var memoryStream = new MemoryStream(data); return memoryStream; }); var contentManagerMock = new Mock<IContentManager>(); contentManagerMock.Expect(c => c.CreateAssetPart<Geometry>()).Returns(() => EngineRuntime.Instance.Kernel.Get<Geometry>()); var loader = new AseLoader(loaderServiceMock.Object, fileLoaderMock.Object, contentManagerMock.Object); var geometries = loader.Load(asset); return geometries; }
public static Geometry[] LoadGeometryFromBytes(byte[] data) { const string asset = "test.ase"; var loaderServiceMock = new Mock <IAssetLoaderService>(); var fileLoaderMock = new Mock <IFileLoader>(); fileLoaderMock.Expect(l => l.GetStream(asset)).Returns( () => { var memoryStream = new MemoryStream(data); return(memoryStream); }); var contentManagerMock = new Mock <IContentManager>(); contentManagerMock.Expect(c => c.CreateAssetPart <Geometry>()).Returns(() => EngineRuntime.Instance.Kernel.Get <Geometry>()); var loader = new AseLoader(loaderServiceMock.Object, fileLoaderMock.Object, contentManagerMock.Object); var geometries = loader.Load(asset); return(geometries); }