public void Comb4Choose3B() { string[] inGrid = { "0.0.0.0.0", ". . . . .", "0.A#C#E#G", ". # # # #", "0.B.D.F.H", ". . . . .", "0.0.0.0.0", }; string[] outGrid = { "0.0.0.0.0", ". . . . .", "0.A#C#E#G", ". # # # #", "0.B#D.F#H", ". . . . .", "0.0.0.0.0", }; TestGridFloorPlan floorPlan = TestGridFloorPlan.InitGridToContext(inGrid); TestGridFloorPlan compareFloorPlan = TestGridFloorPlan.InitGridToContext(outGrid); Mock <IRandom> testRand = new Mock <IRandom>(MockBehavior.Strict); testRand.Setup(p => p.Next(It.IsNotIn <int>(100, 4))).Returns(0); testRand.Setup(p => p.Next(4)).Returns(3); Moq.Language.ISetupSequentialResult <int> seq = testRand.SetupSequence(p => p.Next(100)); seq = seq.Returns(0); seq = seq.Returns(0); seq = seq.Returns(0); seq = seq.Returns(99); var pathGen = new ConnectGridBranchStep <IGridPathTestContext> { ConnectPercent = 50 }; Mock <IRandPicker <PermissiveRoomGen <IGridPathTestContext> > > mockHalls = new Mock <IRandPicker <PermissiveRoomGen <IGridPathTestContext> > >(MockBehavior.Strict); mockHalls.Setup(p => p.Pick(testRand.Object)).Returns(new TestGridRoomGen()); pathGen.GenericHalls = mockHalls.Object; pathGen.ApplyToPath(testRand.Object, floorPlan); TestGridFloorPlan.CompareFloorPlans(floorPlan, compareFloorPlan); }
public void Wishbone() { string[] inGrid = { "0.C#D#E#F.0", ". # . . # .", "A#B.0.0.G.0", ". # . . . .", "0.H.0.0.M.0", ". # . . # .", "0.I#J#K#L.0", }; string[] outGrid = { "0.C#D#E#F.0", ". # . . # .", "A#B.0.0.G.0", ". # . . # .", "0.H.0.0.M.0", ". # . . # .", "0.I#J#K#L.0", }; TestGridFloorPlan floorPlan = TestGridFloorPlan.InitGridToContext(inGrid); TestGridFloorPlan compareFloorPlan = TestGridFloorPlan.InitGridToContext(outGrid); Mock <IRandom> testRand = new Mock <IRandom>(MockBehavior.Strict); testRand.Setup(p => p.Next(It.IsAny <int>())).Returns(0); var pathGen = new ConnectGridBranchStep <IGridPathTestContext> { ConnectPercent = 100 }; Mock <IRandPicker <PermissiveRoomGen <IGridPathTestContext> > > mockHalls = new Mock <IRandPicker <PermissiveRoomGen <IGridPathTestContext> > >(MockBehavior.Strict); mockHalls.Setup(p => p.Pick(testRand.Object)).Returns(new TestGridRoomGen()); pathGen.GenericHalls = mockHalls.Object; pathGen.ApplyToPath(testRand.Object, floorPlan); TestGridFloorPlan.CompareFloorPlans(floorPlan, compareFloorPlan); }