示例#1
0
        private static IEnumerable AdditionTestData()
        {
            var a = new global::Chemistry.Reagent();
            var b = new global::Chemistry.Reagent();
            var c = new global::Chemistry.Reagent();

            //Test adding without overflow
            yield return(new object[]
            {
                50,
                new ReagentMix(a, 10),
                new ReagentMix(a, 10),
                new ReagentMix(a, 20)
            });

            yield return(new object[]
            {
                50,
                new ReagentMix(a, 10),
                new ReagentMix(b, 10),
                new ReagentMix(new DictionaryReagentFloat {
                    { a, 10 }, { b, 10 }
                })
            });

            yield return(new object[]
            {
                50,
                new ReagentMix(new DictionaryReagentFloat {
                    { a, 10 }, { b, 10 }
                }),
                new ReagentMix(a, 5),
                new ReagentMix(new DictionaryReagentFloat {
                    { a, 15 }, { b, 10 }
                })
            });

            yield return(new object[]
            {
                50,
                new ReagentMix(new DictionaryReagentFloat {
                    { a, 10 }, { b, 10 }
                }),
                new ReagentMix(new DictionaryReagentFloat {
                    { a, 5 }, { b, 20 }
                }),
                new ReagentMix(new DictionaryReagentFloat {
                    { a, 15 }, { b, 30 }
                })
            });

            yield return(new object[]
            {
                50,
                new ReagentMix(),
                new ReagentMix(new DictionaryReagentFloat {
                    { a, 8 }, { b, 22 }
                }),
                new ReagentMix(new DictionaryReagentFloat {
                    { a, 8 }, { b, 22 }
                })
            });

            //Test overflow
            yield return(new object[]
            {
                20,
                new ReagentMix(a, 10),
                new ReagentMix(a, 10),
                new ReagentMix(a, 20)
            });

            yield return(new object[]
            {
                20,
                new ReagentMix(a, 10),
                new ReagentMix(a, 15),
                new ReagentMix(a, 20)
            });

            yield return(new object[]
            {
                20,
                new ReagentMix(a, 20),
                new ReagentMix(a, 10),
                new ReagentMix(a, 20)
            });

            //Test multiple overflow
            yield return(new object[]
            {
                10,
                new ReagentMix(),
                new ReagentMix(new DictionaryReagentFloat {
                    { a, 60 }, { b, 10 }, { c, 30 }
                }),
                new ReagentMix(new DictionaryReagentFloat {
                    { a, 6 }, { b, 1 }, { c, 3 }
                })
            });
        }
示例#2
0
        private static IEnumerable RemovalTestData()
        {
            var a = new global::Chemistry.Reagent();
            var b = new global::Chemistry.Reagent();
            var c = new global::Chemistry.Reagent();

            yield return(new object[]
            {
                50,
                new ReagentMix(a, 10),
                5,
                new ReagentMix(a, 5)
            });

            yield return(new object[]
            {
                50,
                new ReagentMix(a, 10),
                10,
                new ReagentMix()
            });

            yield return(new object[]
            {
                50,
                new ReagentMix(a, 10),
                20,
                new ReagentMix()
            });

            yield return(new object[]
            {
                50,
                new ReagentMix(new DictionaryReagentFloat {
                    { a, 10 }, { b, 10 }
                }),
                10,
                new ReagentMix(new DictionaryReagentFloat {
                    { a, 5 }, { b, 5 }
                })
            });

            yield return(new object[]
            {
                50,
                new ReagentMix(new DictionaryReagentFloat {
                    { a, 10 }, { b, 10 }
                }),
                16,
                new ReagentMix(new DictionaryReagentFloat {
                    { a, 2 }, { b, 2 }
                })
            });

            yield return(new object[]
            {
                50,
                new ReagentMix(new DictionaryReagentFloat {
                    { a, 10 }, { b, 10 }
                }),
                20,
                new ReagentMix()
            });

            yield return(new object[]
            {
                50,
                new ReagentMix(new DictionaryReagentFloat {
                    { a, 10 }, { b, 10 }
                }),
                30,
                new ReagentMix()
            });

            yield return(new object[]
            {
                50,
                new ReagentMix(new DictionaryReagentFloat {
                    { a, 10 }, { b, 10 }, { c, 10 }
                }),
                15,
                new ReagentMix(new DictionaryReagentFloat {
                    { a, 5 }, { b, 5 }, { c, 5 }
                })
            });

            yield return(new object[]
            {
                50,
                new ReagentMix(new DictionaryReagentFloat {
                    { a, 10 }, { b, 10 }, { c, 10 }
                }),
                21,
                new ReagentMix(new DictionaryReagentFloat {
                    { a, 3 }, { b, 3 }, { c, 3 }
                })
            });

            yield return(new object[]
            {
                50,
                new ReagentMix(new DictionaryReagentFloat {
                    { a, 10 }, { b, 10 }, { c, 10 }
                }),
                30,
                new ReagentMix()
            });

            yield return(new object[]
            {
                50,
                new ReagentMix(new DictionaryReagentFloat {
                    { a, 10 }, { b, 10 }, { c, 10 }
                }),
                100,
                new ReagentMix()
            });

            yield return(new object[]
            {
                50,
                new ReagentMix(new DictionaryReagentFloat {
                    { a, 10 }, { b, 20 }
                }),
                6,
                new ReagentMix(new DictionaryReagentFloat {
                    { a, 8 }, { b, 16 }
                })
            });

            yield return(new object[]
            {
                50,
                new ReagentMix(new DictionaryReagentFloat {
                    { a, 5 }, { b, 10 }, { c, 15 }
                }),
                12,
                new ReagentMix(new DictionaryReagentFloat {
                    { a, 3 }, { b, 6 }, { c, 9 }
                })
            });
        }