Exemple #1
0
 /// <summary>
 /// Add all the WireMock stubs
 /// </summary>
 public void AddStubs(WireMockFixture wiremockFixture)
 {
     AddExportStubs(wiremockFixture);
     AddServantStubs(wiremockFixture);
     AddCraftEssenceStubs(wiremockFixture);
     AddMysticCodeStubs(wiremockFixture);
 }
Exemple #2
0
        /// <summary>
        /// Create mystic code game data endpoints as WireMock stubs
        /// </summary>
        private void AddMysticCodeStubs(WireMockFixture wiremockFixture)
        {
            // build mock mystic code response
            MysticCodeNiceJson mockResponse = LoadTestData.DeserializeMysticCodeJson(_region, $"{ARTIC_ID}-Artic.json");

            LoadTestData.CreateNiceWireMockStub(wiremockFixture, _region, "MC", ARTIC_ID, mockResponse);

            mockResponse = LoadTestData.DeserializeMysticCodeJson(_region, $"{PLUGSUIT_ID}-CombatUniform.json");
            LoadTestData.CreateNiceWireMockStub(wiremockFixture, _region, "MC", PLUGSUIT_ID, mockResponse);

            mockResponse = LoadTestData.DeserializeMysticCodeJson(_region, $"{FRAGMENT_2004_ID}-Fragment2004.json");
            LoadTestData.CreateNiceWireMockStub(wiremockFixture, _region, "MC", FRAGMENT_2004_ID, mockResponse);
        }
Exemple #3
0
        /// <summary>
        /// Create craft essence game data endpoints as WireMock stubs
        /// </summary>
        private void AddCraftEssenceStubs(WireMockFixture wiremockFixture)
        {
            // build mock craft essence response
            EquipNiceJson mockResponse = LoadTestData.DeserializeCraftEssenceJson(_region, $"{KSCOPE_CE}-Kaleidoscope{_langSuffix}.json");

            LoadTestData.CreateNiceWireMockStub(wiremockFixture, _region, "equip", KSCOPE_CE, mockResponse);

            mockResponse = LoadTestData.DeserializeCraftEssenceJson(_region, $"{IMAGINARY_ELEMENT_CE}-ImaginaryElement{_langSuffix}.json");
            LoadTestData.CreateNiceWireMockStub(wiremockFixture, _region, "equip", IMAGINARY_ELEMENT_CE, mockResponse);

            mockResponse = LoadTestData.DeserializeCraftEssenceJson(_region, $"{AERIAL_DRIVE_CE}-AerialDrive{_langSuffix}.json");
            LoadTestData.CreateNiceWireMockStub(wiremockFixture, _region, "equip", AERIAL_DRIVE_CE, mockResponse);

            mockResponse = LoadTestData.DeserializeCraftEssenceJson(_region, $"{HOLY_NIGHT_SUPPER_CE}-HolyNightSupper{_langSuffix}.json");
            LoadTestData.CreateNiceWireMockStub(wiremockFixture, _region, "equip", HOLY_NIGHT_SUPPER_CE, mockResponse);
        }
Exemple #4
0
        /// <summary>
        /// Create constant game data endpoints as WireMock stubs
        /// </summary>
        private void AddExportStubs(WireMockFixture wiremockFixture)
        {
            const string CONSTANT_RATE_JSON       = "NiceConstant.json";
            const string CLASS_ATTACK_RATE_JSON   = "NiceClassAttackRate.json";
            const string CLASS_RELATION_JSON      = "NiceClassRelation.json";
            const string ATTRIBUTE_RELATION_JSON  = "NiceAttributeRelation.json";
            const string BASIC_SERVANT_JSON       = "basic_servant.json";
            const string BASIC_EQUIP_JSON         = "basic_equip.json";
            const string SVT_GRAIL_COST_NICE_JSON = "NiceSvtGrailCost.json";

            // build necessary export mock responses
            ConstantNiceJson mockConstantRateResponse = LoadTestData.DeserializeExportJson <ConstantNiceJson>(_region, CONSTANT_RATE_JSON);

            LoadTestData.CreateExportWireMockStub(wiremockFixture, _region, CONSTANT_RATE_JSON, mockConstantRateResponse);

            ClassAttackRateNiceJson mockClassAttackRateResponse = LoadTestData.DeserializeExportJson <ClassAttackRateNiceJson>(_region, CLASS_ATTACK_RATE_JSON);

            LoadTestData.CreateExportWireMockStub(wiremockFixture, _region, CLASS_ATTACK_RATE_JSON, mockClassAttackRateResponse);

            ClassRelationNiceJson mockClassRelationResponse = LoadTestData.DeserializeExportJson <ClassRelationNiceJson>(_region, CLASS_RELATION_JSON);

            LoadTestData.CreateExportWireMockStub(wiremockFixture, _region, CLASS_RELATION_JSON, mockClassRelationResponse);

            AttributeRelationNiceJson mockAttributeRelationResponse = LoadTestData.DeserializeExportJson <AttributeRelationNiceJson>(_region, ATTRIBUTE_RELATION_JSON);

            LoadTestData.CreateExportWireMockStub(wiremockFixture, _region, ATTRIBUTE_RELATION_JSON, mockAttributeRelationResponse);

            ServantBasicJsonCollection mockServantBasicJsonResponse = LoadTestData.DeserializeExportJson <ServantBasicJsonCollection>(_region, BASIC_SERVANT_JSON);

            LoadTestData.CreateExportWireMockStub(wiremockFixture, _region, BASIC_SERVANT_JSON, mockServantBasicJsonResponse);

            EquipBasicJsonCollection mockEquipBasicJsonResponse = LoadTestData.DeserializeExportJson <EquipBasicJsonCollection>(_region, BASIC_EQUIP_JSON);

            LoadTestData.CreateExportWireMockStub(wiremockFixture, _region, BASIC_EQUIP_JSON, mockEquipBasicJsonResponse);

            GrailCostNiceJson mockSvtGrailCostNiceResponse = LoadTestData.DeserializeExportJson <GrailCostNiceJson>(_region, SVT_GRAIL_COST_NICE_JSON);

            LoadTestData.CreateExportWireMockStub(wiremockFixture, _region, SVT_GRAIL_COST_NICE_JSON, mockSvtGrailCostNiceResponse);
        }
Exemple #5
0
        /// <summary>
        /// Create servant game data endpoints as WireMock stubs
        /// </summary>
        private void AddServantStubs(WireMockFixture wiremockFixture)
        {
            // build mock servant responses
            ServantNiceJson mockResponse = LoadTestData.DeserializeServantJson(_region, "Archer", $"{ARASH_ARCHER}-Arash{_langSuffix}.json");

            LoadTestData.CreateNiceWireMockStub(wiremockFixture, _region, "servant", ARASH_ARCHER, mockResponse);

            mockResponse = LoadTestData.DeserializeServantJson(_region, "Archer", $"{ATALANTE_ARCHER}-Atalante{_langSuffix}.json");
            LoadTestData.CreateNiceWireMockStub(wiremockFixture, _region, "servant", ATALANTE_ARCHER, mockResponse);

            mockResponse = LoadTestData.DeserializeServantJson(_region, "Archer", $"{GILGAMESH_ARCHER}-Gilgamesh{_langSuffix}.json");
            LoadTestData.CreateNiceWireMockStub(wiremockFixture, _region, "servant", GILGAMESH_ARCHER, mockResponse);

            mockResponse = LoadTestData.DeserializeServantJson(_region, "Assassin", $"{JACK_ASSASSIN}-Jack{_langSuffix}.json");
            LoadTestData.CreateNiceWireMockStub(wiremockFixture, _region, "servant", JACK_ASSASSIN, mockResponse);

            mockResponse = LoadTestData.DeserializeServantJson(_region, "Avenger", $"{DANTES_AVENGER}-EdmondDantes{_langSuffix}.json");
            LoadTestData.CreateNiceWireMockStub(wiremockFixture, _region, "servant", DANTES_AVENGER, mockResponse);

            mockResponse = LoadTestData.DeserializeServantJson(_region, "Berserker", $"{LANCELOT_BERSERKER}-Lancelot{_langSuffix}.json");
            LoadTestData.CreateNiceWireMockStub(wiremockFixture, _region, "servant", LANCELOT_BERSERKER, mockResponse);

            mockResponse = LoadTestData.DeserializeServantJson(_region, "Berserker", $"{RAIKOU_BERSERKER}-Raikou{_langSuffix}.json");
            LoadTestData.CreateNiceWireMockStub(wiremockFixture, _region, "servant", RAIKOU_BERSERKER, mockResponse);

            mockResponse = LoadTestData.DeserializeServantJson(_region, "Berserker", $"{SPARTACUS_BERSERKER}-Spartacus{_langSuffix}.json");
            LoadTestData.CreateNiceWireMockStub(wiremockFixture, _region, "servant", SPARTACUS_BERSERKER, mockResponse);

            mockResponse = LoadTestData.DeserializeServantJson(_region, "Caster", $"{HELENA_CASTER}-HelenaBlavatsky{_langSuffix}.json");
            LoadTestData.CreateNiceWireMockStub(wiremockFixture, _region, "servant", HELENA_CASTER, mockResponse);

            mockResponse = LoadTestData.DeserializeServantJson(_region, "Caster", $"{MERLIN_CASTER}-Merlin{_langSuffix}.json");
            LoadTestData.CreateNiceWireMockStub(wiremockFixture, _region, "servant", MERLIN_CASTER, mockResponse);

            mockResponse = LoadTestData.DeserializeServantJson(_region, "Caster", $"{NITOCRIS_CASTER}-Nitocris{_langSuffix}.json");
            LoadTestData.CreateNiceWireMockStub(wiremockFixture, _region, "servant", NITOCRIS_CASTER, mockResponse);

            mockResponse = LoadTestData.DeserializeServantJson(_region, "Caster", $"{SKADI_CASTER}-ScathachSkadi{_langSuffix}.json");
            LoadTestData.CreateNiceWireMockStub(wiremockFixture, _region, "servant", SKADI_CASTER, mockResponse);

            mockResponse = LoadTestData.DeserializeServantJson(_region, "Caster", $"{SHAKESPEARE_CASTER}-WilliamShakespeare{_langSuffix}.json");
            LoadTestData.CreateNiceWireMockStub(wiremockFixture, _region, "servant", SHAKESPEARE_CASTER, mockResponse);

            mockResponse = LoadTestData.DeserializeServantJson(_region, "Caster", $"{WAVER_CASTER}-ZhugeLiang{_langSuffix}.json");
            LoadTestData.CreateNiceWireMockStub(wiremockFixture, _region, "servant", WAVER_CASTER, mockResponse);

            mockResponse = LoadTestData.DeserializeServantJson(_region, "Lancer", $"{PARVATI_LANCER}-Parvati{_langSuffix}.json");
            LoadTestData.CreateNiceWireMockStub(wiremockFixture, _region, "servant", PARVATI_LANCER, mockResponse);

            mockResponse = LoadTestData.DeserializeServantJson(_region, "Lancer", $"{VALKYRIE_LANCER}-Valkyrie{_langSuffix}.json");
            LoadTestData.CreateNiceWireMockStub(wiremockFixture, _region, "servant", VALKYRIE_LANCER, mockResponse);

            mockResponse = LoadTestData.DeserializeServantJson(_region, "Rider", $"{ASTOLFO_RIDER}-Astolfo{_langSuffix}.json");
            LoadTestData.CreateNiceWireMockStub(wiremockFixture, _region, "servant", ASTOLFO_RIDER, mockResponse);

            mockResponse = LoadTestData.DeserializeServantJson(_region, "Rider", $"{SIMA_YI_RIDER}-SimaYiReines{_langSuffix}.json");
            LoadTestData.CreateNiceWireMockStub(wiremockFixture, _region, "servant", SIMA_YI_RIDER, mockResponse);

            mockResponse = LoadTestData.DeserializeServantJson(_region, "Rider", $"{USHI_RIDER}-Ushiwakamaru{_langSuffix}.json");
            LoadTestData.CreateNiceWireMockStub(wiremockFixture, _region, "servant", USHI_RIDER, mockResponse);

            mockResponse = LoadTestData.DeserializeServantJson(_region, "Saber", $"{NERO_CLAUDIUS_BRIDE}-NeroClaudiusBride{_langSuffix}.json");
            LoadTestData.CreateNiceWireMockStub(wiremockFixture, _region, "servant", NERO_CLAUDIUS_BRIDE, mockResponse);

            mockResponse = LoadTestData.DeserializeServantJson("JP", "Saber", $"{TOMOE_GOZEN_SABER}-TomoeGozenEN.json");
            LoadTestData.CreateNiceWireMockStub(wiremockFixture, "JP", "servant", TOMOE_GOZEN_SABER, mockResponse);
        }
 public PostsControllerTests(WireMockFixture wireMockFixture)
 {
     _client      = wireMockFixture.Client;
     _postsServer = wireMockFixture.PostsServer;
 }
Exemple #7
0
 public UsersControllerTests(WireMockFixture wireMockFixture)
 {
     _client      = wireMockFixture.Client;
     _usersServer = wireMockFixture.UsersServer;
 }
Exemple #8
0
 /// <summary>
 /// Creates a WireMock stub to represent a mock request and response
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="wiremockFixture">Mock server</param>
 /// <param name="region">NA or JP</param>
 /// <param name="exportFilename">The export's file name</param>
 /// <param name="mockResponse">The expected JSON response</param>
 public static void CreateExportWireMockStub <T>(WireMockFixture wiremockFixture, string region, string exportFilename, T mockResponse)
 {
     wiremockFixture.MockServer
     .Given(Request.Create().WithPath($"/export/{region}/{exportFilename}").UsingGet())
     .RespondWith(Response.Create().WithStatusCode(200).WithHeader("Content-Type", "application/json").WithBodyAsJson(mockResponse));
 }
Exemple #9
0
 /// <summary>
 /// Creates a WireMock stub to represent a mock request and response
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="wiremockFixture">Mock server</param>
 /// <param name="region">NA or JP</param>
 /// <param name="objectPath">Path for NICE json data like "servant" or "equip" or "MC"</param>
 /// <param name="id">The actual ID, not their collection ID</param>
 /// <param name="mockResponse">The expected JSON response</param>
 public static void CreateNiceWireMockStub <T>(WireMockFixture wiremockFixture, string region, string objectPath, string id, T mockResponse)
 {
     wiremockFixture.MockServer
     .Given(Request.Create().WithPath($"/nice/{region}/{objectPath}/{id}").WithParam("lang", "en").UsingGet())
     .RespondWith(Response.Create().WithStatusCode(200).WithHeader("Content-Type", "application/json").WithBodyAsJson(mockResponse));
 }