Esempio n. 1
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);
        }
Esempio n. 2
0
        public async Task GetAttributeRelationInfo()
        {
            _wiremockFixture.CheckIfMockServerInUse();

            AttributeRelationNiceJson mockResponse = new AttributeRelationNiceJson
            {
                Human = new Human
                {
                    HumanMultiplier = 1000
                }
            };

            _wiremockFixture.MockServer
            .Given(Request.Create().WithPath($"/export/{REGION}/NiceAttributeRelation.json").UsingGet())
            .RespondWith(Response.Create().WithStatusCode(200).WithHeader(CONTENT_TYPE_HEADER, CONTENT_TYPE_APPLICATION_JSON).WithBodyAsJson(mockResponse));

            using (var scope = _container.BeginLifetimeScope())
            {
                ScopedClasses             resolvedClasses = AutofacUtility.ResolveScope(scope);
                AttributeRelationNiceJson response        = await resolvedClasses.AtlasAcademyClient.GetAttributeRelationInfo();

                response.Human.HumanMultiplier.Should().Be(1000);
            }
        }
 public AttributeRelation(AttributeRelationNiceJson attributeRelations)
 {
     _attributeRelations = attributeRelations;
 }