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));
		}
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
		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;
		}
Ejemplo n.º 4
0
        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);
        }