private static ISchemeService CreateSchemeService() { var schemeServiceMock = new Mock <ISchemeService>(); var propScheme = new PropScheme { Sid = "test-prop" }; schemeServiceMock.Setup(x => x.GetScheme <PropScheme>(It.IsAny <string>())) .Returns(propScheme); var trophyTableScheme = new DropTableScheme(0, new DropTableRecordSubScheme[0]) { Sid = "default" }; schemeServiceMock.Setup(x => x.GetScheme <DropTableScheme>(It.IsAny <string>())) .Returns(trophyTableScheme); var monsterScheme = new MonsterScheme { PrimaryAct = new TacticalActStatsSubScheme { Efficient = new Range <float>(10, 20) } }; schemeServiceMock.Setup(x => x.GetScheme <MonsterScheme>(It.IsAny <string>())) .Returns(monsterScheme); var schemeService = schemeServiceMock.Object; return(schemeService); }
public void GetPropsTest() { // ARRANGE const string testPropSchemeSid = "test-resource"; var testResourceScheme = new PropScheme { Sid = testPropSchemeSid }; var randomSourceMock = new Mock <IDropResolverRandomSource>(); randomSourceMock.Setup(x => x.RollWeight(It.IsAny <int>())) .Returns(1); randomSourceMock.Setup(x => x.RollResourceCount(It.IsAny <int>(), It.IsAny <int>())) .Returns(1); var randomSource = randomSourceMock.Object; var schemeServiceMock = new Mock <ISchemeService>(); schemeServiceMock.Setup(x => x.GetScheme <PropScheme>(It.Is <string>(sid => sid == testPropSchemeSid))) .Returns(testResourceScheme); var schemeService = schemeServiceMock.Object; var propFactoryMock = new Mock <IPropFactory>(); var propFactory = propFactoryMock.Object; var resolver = new DropResolver(randomSource, schemeService, propFactory); var testDropTableRecord = new DropTableRecordSubScheme(testPropSchemeSid, 1) { MinCount = 1, MaxCount = 1 }; var testDropTable = new DropTableScheme(1, testDropTableRecord); // ACT var factProps = resolver.GetProps(new[] { testDropTable }); // ASSERT factProps.Count().Should().Be(1); factProps[0].Scheme.Should().BeSameAs(testResourceScheme); ((Resource)factProps[0]).Count.Should().Be(1); }
private DropTableScheme[] GetMonsterDropTables(MonsterScheme monsterScheme) { if (monsterScheme.DropTableSids == null) { return(new DropTableScheme[0]); } var dropTableCount = monsterScheme.DropTableSids.Length; var schemes = new DropTableScheme[dropTableCount]; for (var i = 0; i < dropTableCount; i++) { var sid = monsterScheme.DropTableSids[i]; schemes[i] = _schemeService.GetScheme <DropTableScheme>(sid); } return(schemes); }
public void DropTablePropContainerTest() { // ARRANGE var nodeMock = new Mock <IMapNode>(); var node = nodeMock.Object; var dropTableRecord = new DropTableRecordSubScheme("test-prop", 1) { MinCount = 1, MaxCount = 1 }; var dropTable = new DropTableScheme(1, dropTableRecord); var testPropScheme = new PropScheme { Sid = "test-prop" }; var dropResolverMock = new Mock <IDropResolver>(); dropResolverMock.Setup(x => x.GetProps(It.IsAny <IEnumerable <DropTableScheme> >())) .Returns(new IProp[] { new Resource(testPropScheme, 1) }); var dropResolver = dropResolverMock.Object; var container = new DropTablePropChest(node, new[] { dropTable }, dropResolver); // ACT var factProps = container.Content.CalcActualItems(); // ASSERT factProps.Count().Should().Be(1); factProps[0].Scheme.Should().BeSameAs(testPropScheme); ((Resource)factProps[0]).Count.Should().Be(1); }