コード例 #1
0
		public static void GlobalSetup(TestContext testContext)
		{
			var config = new XDoc("config");

            var instances = new XDoc("instances")
                .Start("instance").Attr("webhost", "test.foiremuses.org").Attr("databaseName", "foiremusesxml")
                .Start("components")
                .Start("component").Attr("type", "FoireMuses.Core.Interfaces.IScoreDataMapper, FoireMuses.Core")
                .Attr("implementation", "FoireMuses.Core.Loveseat.LoveseatScoreDataMapper, FoireMuses.Core.Loveseat")
                .Attr("name", "ScoreDataMapper").End()
                .Start("component").Attr("type", "FoireMuses.Core.Interfaces.IPlayDataMapper, FoireMuses.Core")
                .Attr("implementation", "FoireMuses.Core.Loveseat.LoveseatPlayDataMapper, FoireMuses.Core.Loveseat")
                .Attr("name", "PlayDataMapper").End()
                .Start("component").Attr("type", "FoireMuses.Core.Interfaces.ISourceDataMapper, FoireMuses.Core")
                .Attr("implementation", "FoireMuses.Core.Loveseat.LoveseatSourceDataMapper, FoireMuses.Core.Loveseat")
                .Attr("name", "SourceDataMapper").End()
                .Start("component").Attr("type", "FoireMuses.Core.Interfaces.IUserDataMapper, FoireMuses.Core")
                .Attr("implementation", "FoireMuses.Core.Loveseat.LoveseatUserDataMapper, FoireMuses.Core.Loveseat")
                .Attr("name", "UserDataMapper").End()
                .End().End();

			var builder = new ContainerBuilder();
			mscore = new MockScoreController();
            msource = new MockSourceController();
            mplay = new MockPlayController();
            muser = new MockUserController();
			builder.Register(c => mscore).As<IScoreController>().ServiceScoped();
            builder.Register(c => mplay).As<IPlayController>().ServiceScoped();
            builder.Register(c => msource).As<ISourceController>().ServiceScoped();
            builder.Register(c => muser).As<IUserController>().ServiceScoped();
			_hostInfo = DreamTestHelper.CreateRandomPortHost(config, builder.Build());
			_hostInfo.Host.Self.At("load").With("name", "foiremuses.webservice").Post(DreamMessage.Ok());
			_service = DreamTestHelper.CreateService(
				_hostInfo,
				"http://foiremuses.org/service",
				"foiremuses",
				instances
			);
			_plug = _service.WithInternalKey().AtLocalHost;
		}
コード例 #2
0
		public void Setup()
		{
            mscore = new MockScoreController();
            msource = new MockSourceController();
            mplay = new MockPlayController();
            muser = new MockUserController();
		}