예제 #1
0
파일: Maker.cs 프로젝트: jiowchern/Regulus
        public Maker(int item_id , MaterialQualityAnalyzer analyzer)
        {
            _ItemId = item_id;
            _Analyzer = analyzer;

            //_EffectBuilder = new EffectBuilder();
        }
        public void GetQualityTest1()
        {
            var materials = new Material[] { new Material { Id = 1 , Count = 5},
                                            new Material { Id = 2 , Count = 4},
                                            new Material { Id = 3 , Count = 1}};
            var recipeMaterials = new Material[] { new Material { Id = 1 , Count = 5},
                                            new Material { Id = 2 , Count = 4},
                                            new Material { Id = 3 , Count = 1}};
            var recipe = new MaterialQualityAnalyzer(recipeMaterials);
            var quality = recipe.GetQuality(materials);
            var eQuality = 1.0f;

            Assert.AreEqual(quality, eQuality);
        }
        public void GetQualityTest()
        {
            var materials = new Material[] { new Material { Id = 1 , Count = 1},
                                            new Material { Id = 2 , Count = 7},
                                            new Material { Id = 3 , Count = 2}};
            var recipeMaterials = new Material[] { new Material { Id = 1 , Count = 5},
                                            new Material { Id = 2 , Count = 4},
                                            new Material { Id = 3 , Count = 1}};
            var recipe = new MaterialQualityAnalyzer(recipeMaterials);
            var quality = recipe.GetQuality(materials);
            var eQuality = (0.1f / 0.7f) * 0.4f + (0.7f / 0.7f) * 0.4f + (0.2f / 0.7f) * 0.4f;

            Assert.AreEqual(quality, eQuality);
        }