Example #1
0
        public void _投入合計金額表示を処理する_受け付けない金種を投入した場合()
        {
            var repo = new Ninject.StandardKernel()
                       .BindPurchaseContext()
                       .BindRunnerRepository()
                       .Get <IRunnerRepository>()
            ;

            Action runner;
            var    fixtures = new _コマンドパーサに渡すTestFixture().InvalidInsMoneyParams;

            foreach (var param in fixtures.Select(f => f.Expected))
            {
                runner = repo.FindRunner(param, null);
                runner();

                var passed = false;
                runner = repo.FindRunner(new ShowAmountParseResult(), (message) => {
                    Assert.That(message, Is.EqualTo("Not received."));
                    passed = true;
                });
                runner();

                Assert.That(repo.PurchaseContext.ReceivedTotal, Is.EqualTo(0));
                Assert.That(passed, Is.True);
            }
        }
Example #2
0
        public void _お金の排出依頼を処理する()
        {
            var parameters = new _コマンドパーサに渡すTestFixture().InsMoneyParams
                             .Select(p => p.Expected)
                             .Cast <MoneyInsertionParseResult>()
            ;

            var repo = new Ninject.StandardKernel()
                       .BindPurchaseContext()
                       .BindRunnerRepository()
                       .Get <IRunnerRepository>()
            ;

            Action runner;

            foreach (var parameter in parameters)
            {
                runner = repo.FindRunner(parameter, null);
                runner();
            }

            Assert.That(repo.PurchaseContext.ReceivedTotal, Is.GreaterThan(0));

            runner = repo.FindRunner(new MoneyEjectParseResult(), null);
            runner();

            Assert.That(repo.PurchaseContext.ReceivedTotal, Is.EqualTo(0));
        }
Example #3
0
        public void _陳列された商品の表示依頼を処理する_未入金の場合()
        {
            var repo = new Ninject.StandardKernel()
                       .BindPurchaseContextContainingSoldout()
                       .BindRunnerRepository()
                       .Get <IRunnerRepository>()
            ;

            Assert.That(repo.PurchaseContext.ReceivedTotal, Is.EqualTo(0));

            var expected = new string[] {
                "       # Name                     Price",
                "-----+--+------------------------+------",
                " [ ]   1 Item0...................   300",
                " [ ]   2 Item1...................  1200",
                " [-]   3 Item2...................   900",
                " [ ]   4 Item3...................   600"
            };

            var it = expected.GetEnumerator();

            var runner = repo.FindRunner(new ShowItemParseResult(), (message) => {
                Assert.That(it.MoveNext(), Is.True);
                Assert.That(message, Is.EqualTo(it.Current));
            });

            runner();

            Assert.That(repo.PurchaseContext.ReceivedTotal, Is.EqualTo(0));
            Assert.That(it.MoveNext(), Is.False);
        }
Example #4
0
        public void _パースされた投入金額を処理する_連続投入()
        {
            var parameters = new _コマンドパーサに渡すTestFixture().InsMoneyParams
                             .Select(p => p.Expected)
                             .Cast <MoneyInsertionParseResult>();

            var repo = new Ninject.StandardKernel()
                       .BindPurchaseContext()
                       .BindRunnerRepository()
                       .Get <IRunnerRepository>()
            ;

            foreach (var parameter in parameters)
            {
                var runner = repo.FindRunner(parameter, null);

                runner();
            }

            var totalAmount = parameters
                              .Sum(r => (r.Money.Value() * r.Count))
            ;

            Assert.That(repo.PurchaseContext.ReceivedTotal, Is.EqualTo(totalAmount));
        }
Example #5
0
        public void _ヘルプ表示依頼を処理する_コマンド指定()
        {
            var repo = new Ninject.StandardKernel()
                       .BindPurchaseContext()
                       .BindRunnerRepository()
                       .Get <IRunnerRepository>()
            ;

            var result = new HelpParseResult {
                Command = "ins"
            };
            var content = ConsoleAppHelper.ListHelpContents()
                          .Where(c => c.Command == result.Command).FirstOrDefault();

            var it = (new string[] { content.Usage, content.Description }).GetEnumerator();

            var runner = repo.FindRunner(result, (message) => {
                Assert.That(it.MoveNext(), Is.True);
                Assert.That(message, Is.Not.Null.And.Not.Empty);
                Assert.That(message, Is.EqualTo(it.Current));
            });

            runner();

            Assert.That(it.MoveNext(), Is.False);
        }
Example #6
0
        public void _投入合計金額表示を処理する_お金を投入した場合()
        {
            var repo = new Ninject.StandardKernel()
                       .BindPurchaseContext()
                       .BindRunnerRepository()
                       .Get <IRunnerRepository>()
            ;

            Action runner;
            var    fixtures = new _コマンドパーサに渡すTestFixture().InsMoneyParams;

            foreach (var param in fixtures.Select(f => f.Expected))
            {
                runner = repo.FindRunner(param, null);
                runner();
            }

            var expected = fixtures
                           .Select(f => f.Expected)
                           .Cast <MoneyInsertionParseResult>()
                           .Sum(r => r.Money.Value() * r.Count)
            ;

            var passed = false;

            runner = repo.FindRunner(new ShowAmountParseResult(), (message) => {
                Assert.That(message, Is.EqualTo(string.Format("total money is {0}.", expected)));
                Assert.That(message, Is.EqualTo(string.Format("total money is {0}.", repo.PurchaseContext.ReceivedTotal)));
                passed = true;
            });
            runner();
            Assert.That(passed, Is.True);

            runner = repo.FindRunner(new MoneyEjectParseResult(), null);
            runner();

            passed = false;
            runner = repo.FindRunner(new ShowAmountParseResult(), (message) => {
                Assert.That(message, Is.EqualTo("Not received."));
                passed = true;
            });
            runner();
            Assert.That(passed, Is.True);
        }
Example #7
0
        public void _陳列された商品の表示依頼を処理する_受け付けない金種を投入した場合()
        {
            var repo = new Ninject.StandardKernel()
                       .BindPurchaseContextContainingSoldout()
                       .BindRunnerRepository()
                       .Get <IRunnerRepository>()
            ;

            Assert.That(repo.PurchaseContext.ReceivedTotal, Is.EqualTo(0));

            Action runner;
            var    fixtures = new _コマンドパーサに渡すTestFixture().InvalidInsMoneyParams;

            foreach (var param in fixtures.Select(f => f.Expected))
            {
                var expected = new string[] {
                    "       # Name                     Price",
                    "-----+--+------------------------+------",
                    " [ ]   1 Item0...................   300",
                    " [ ]   2 Item1...................  1200",
                    " [-]   3 Item2...................   900",
                    " [ ]   4 Item3...................   600"
                };
                var it = expected.GetEnumerator();

                runner = repo.FindRunner(param, null);
                runner();

                runner = repo.FindRunner(new ShowItemParseResult(), (message) => {
                    Assert.That(it.MoveNext(), Is.True);
                    Assert.That(message, Is.EqualTo(it.Current));
                });
                runner();

                Assert.That(it.MoveNext(), Is.False);
                Assert.That(repo.PurchaseContext.ReceivedTotal, Is.EqualTo(0));
            }
        }
Example #8
0
        public void _パースされた投入金額を処理する(
            [ValueSource(typeof(_コマンドパーサに渡すTestFixture), "InsMoneyParams")] _コマンドパーサに渡すTestFixture.Parameter inParameter)
        {
            var repo = new Ninject.StandardKernel()
                       .BindPurchaseContext()
                       .BindRunnerRepository()
                       .Get <IRunnerRepository>()
            ;

            var runner = repo.FindRunner(inParameter.Expected, null);

            runner();

            var expected = (MoneyInsertionParseResult)inParameter.Expected;

            Assert.That(repo.PurchaseContext.ReceivedTotal, Is.EqualTo(expected.Money.Value() * expected.Count));
        }
Example #9
0
        public void _ヘルプ表示依頼を処理する()
        {
            var repo = new Ninject.StandardKernel()
                       .BindPurchaseContext()
                       .BindRunnerRepository()
                       .Get <IRunnerRepository>()
            ;

            var it = ConsoleTestHelper.ListExpectedHelpContents().GetEnumerator();

            var runner = repo.FindRunner(new HelpParseResult(), (message) => {
                Assert.That(it.MoveNext(), Is.True);
                Assert.That(message, Is.Not.Null.And.Not.Empty);
                Assert.That(message, Is.EqualTo(it.Current));
            });

            runner();

            Assert.That(it.MoveNext(), Is.False);
        }
Example #10
0
        public void _投入合計金額表示を処理する_未入金の場合()
        {
            var repo = new Ninject.StandardKernel()
                       .BindPurchaseContext()
                       .BindRunnerRepository()
                       .Get <IRunnerRepository>()
            ;

            Assert.That(repo.PurchaseContext.ReceivedTotal, Is.EqualTo(0));

            var passed = false;
            var runner = repo.FindRunner(new ShowAmountParseResult(), (message) => {
                Assert.That(message, Is.EqualTo("Not received."));
                passed = true;
            });

            runner();

            Assert.That(repo.PurchaseContext.ReceivedTotal, Is.EqualTo(0));
            Assert.That(passed, Is.True);
        }
Example #11
0
        public void _お金の排出依頼を処理する_入金がない場合()
        {
            var repo = new Ninject.StandardKernel()
                       .BindPurchaseContext()
                       .BindRunnerRepository()
                       .Get <IRunnerRepository>()
            ;

            Assert.That(repo.PurchaseContext.ReceivedTotal, Is.EqualTo(0));

            var passed = false;
            var runner = repo.FindRunner(new MoneyEjectParseResult(), (message) => {
                Assert.That(message, Is.EqualTo("money is not inserted."));
                passed = true;
            });

            runner();

            Assert.That(repo.PurchaseContext.ReceivedTotal, Is.EqualTo(0));

            Assert.That(passed, Is.True);
        }
Example #12
0
        public void _投入合計金額表示を処理する_お金を投入した場合()
        {
            var repo = new Ninject.StandardKernel()
                .BindPurchaseContext()
                    .BindRunnerRepository()
                    .Get<IRunnerRepository>()
                    ;

            Action runner;
            var fixtures = new _コマンドパーサに渡すTestFixture().InsMoneyParams;
            foreach (var param in fixtures.Select(f => f.Expected)) {
                runner = repo.FindRunner(param, null);
                runner();

            }

            var expected = fixtures
                .Select(f => f.Expected)
                    .Cast<MoneyInsertionParseResult>()
                    .Sum(r => r.Money.Value() * r.Count)
            ;

            var passed = false;
            runner = repo.FindRunner(new ShowAmountParseResult(), (message) => {
                Assert.That(message, Is.EqualTo(string.Format("total money is {0}.", expected)));
                Assert.That(message, Is.EqualTo(string.Format("total money is {0}.", repo.PurchaseContext.ReceivedTotal)));
                passed = true;
            });
            runner();
            Assert.That(passed, Is.True);

            runner = repo.FindRunner(new MoneyEjectParseResult(), null);
            runner();

            passed = false;
            runner = repo.FindRunner(new ShowAmountParseResult(), (message) => {
                Assert.That(message, Is.EqualTo("Not received."));
                passed = true;
            });
            runner();
            Assert.That(passed, Is.True);
        }
Example #13
0
        public void _商品の購入依頼を処理する_釣り銭不足で購入できない商品を選択した場合()
        {
            var repo = new Ninject.StandardKernel()
                .BindNoChangeContext()
                    .BindRunnerRepository()
                    .Get<IRunnerRepository>()
                    ;

            Action runner;
            runner = repo.FindRunner( new MoneyInsertionParseResult {Money = Money.Coin500, Count=1}, null);
            runner();

            var result = new PurchaseParseResult {
                Positions = new int[] {1}
            };

            var expected = new string[] {
                "Sorry, can not purchase this item because of lack of changes.",
            };
            var it = expected.GetEnumerator();

            runner = repo.FindRunner(result, (message) => {
                Assert.That(it.MoveNext(), Is.True);
                Assert.That(message, Is.Not.Null.And.Not.Empty);
                Assert.That(message, Is.EqualTo(it.Current));
            });

            runner();

            Assert.That(it.MoveNext(), Is.False);
        }
Example #14
0
        public void _商品の購入依頼を処理する_正しくないインデックスを含む一件の場合()
        {
            var repo = new Ninject.StandardKernel()
                .BindPurchaseContext()
                    .BindRunnerRepository()
                    .Get<IRunnerRepository>()
                    ;

            var fixtures = new _コマンドパーサに渡すTestFixture().InsMoneyParams
                .Select(f => f.Expected)
                    .Cast<MoneyInsertionParseResult>()
                    ;

            Action runner;
            foreach (var f in fixtures) {
                runner = repo.FindRunner(f, null);

                runner();
            }

            var result = new PurchaseParseResult {
                Positions = new int[] {-1}
            };

            var expected = new string[] {
                "Item is not placed.",
            };
            var it = expected.GetEnumerator();

            runner = repo.FindRunner(result, (message) => {
                Assert.That(it.MoveNext(), Is.True);
                Assert.That(message, Is.Not.Null.And.Not.Empty);
                Assert.That(message, Is.EqualTo(it.Current));
            });

            runner();

            Assert.That(it.MoveNext(), Is.False);
        }
Example #15
0
        public void _商品の購入依頼を処理する_未入金で複数件同時の場合()
        {
            var repo = new Ninject.StandardKernel()
                .BindPurchaseContextContainingSoldout()
                .BindRunnerRepository()
                .Get<IRunnerRepository>()
            ;

            Assert.That(repo.PurchaseContext.ReceivedTotal, Is.EqualTo(0));

            var result = new PurchaseParseResult {
                Positions = new int[] {4, 1}
            };

            var expected = new string[] {
                "Money enough to purchase is not inserted. (left: 600)",
                "Money enough to purchase is not inserted. (left: 300)",
            };
            var it = expected.GetEnumerator();

            var runner = repo.FindRunner(result, (message) => {
                Assert.That(it.MoveNext(), Is.True);
                Assert.That(message, Is.Not.Null.And.Not.Empty);
                Assert.That(message, Is.EqualTo(it.Current));
            });

            runner();

            Assert.That(it.MoveNext(), Is.False);
        }
Example #16
0
        public void _ヘルプ表示依頼を処理する_コマンド指定()
        {
            var repo = new Ninject.StandardKernel()
                .BindPurchaseContext()
                .BindRunnerRepository()
                .Get<IRunnerRepository>()
            ;

            var result = new HelpParseResult { Command = "ins"};
            var content = ConsoleAppHelper.ListHelpContents()
                .Where(c => c.Command == result.Command).FirstOrDefault();

            var it = (new string[] {content.Usage, content.Description}).GetEnumerator();

            var runner = repo.FindRunner(result, (message) => {
                Assert.That(it.MoveNext(), Is.True);
                Assert.That(message, Is.Not.Null.And.Not.Empty);
                Assert.That(message, Is.EqualTo(it.Current));
            });

            runner();

            Assert.That(it.MoveNext(), Is.False);
        }
Example #17
0
        public void _ヘルプ表示依頼を処理する()
        {
            var repo = new Ninject.StandardKernel()
                .BindPurchaseContext()
                .BindRunnerRepository()
                .Get<IRunnerRepository>()
            ;

            var it = ConsoleTestHelper.ListExpectedHelpContents().GetEnumerator();

            var runner = repo.FindRunner(new HelpParseResult(), (message) => {
                Assert.That(it.MoveNext(), Is.True);
                Assert.That(message, Is.Not.Null.And.Not.Empty);
                Assert.That(message, Is.EqualTo(it.Current));
            });

            runner();

            Assert.That(it.MoveNext(), Is.False);
        }
Example #18
0
        public void _パースされた投入金額を処理する_連続投入()
        {
            var parameters = new _コマンドパーサに渡すTestFixture().InsMoneyParams
                .Select(p => p.Expected)
                .Cast<MoneyInsertionParseResult>();

            var repo = new Ninject.StandardKernel()
                .BindPurchaseContext()
                .BindRunnerRepository()
                .Get<IRunnerRepository>()
            ;

            foreach (var parameter in parameters) {
                var runner = repo.FindRunner(parameter, null);

                runner();
            }

            var totalAmount = parameters
                .Sum(r => (r.Money.Value() * r.Count))
            ;
            Assert.That(repo.PurchaseContext.ReceivedTotal, Is.EqualTo(totalAmount));
        }
Example #19
0
        public void _陳列された商品の表示依頼を処理する_未入金の場合()
        {
            var repo = new Ninject.StandardKernel()
                .BindPurchaseContextContainingSoldout()
                .BindRunnerRepository()
                .Get<IRunnerRepository>()
            ;

            Assert.That(repo.PurchaseContext.ReceivedTotal, Is.EqualTo(0));

            var expected = new string[] {
                "       # Name                     Price",
                "-----+--+------------------------+------",
                " [ ]   1 Item0...................   300",
                " [ ]   2 Item1...................  1200",
                " [-]   3 Item2...................   900",
                " [ ]   4 Item3...................   600"
            };

            var it = expected.GetEnumerator();

            var runner = repo.FindRunner(new ShowItemParseResult(), (message) => {
                Assert.That(it.MoveNext(), Is.True);
                Assert.That(message, Is.EqualTo(it.Current));
            });
            runner();

            Assert.That(repo.PurchaseContext.ReceivedTotal, Is.EqualTo(0));
            Assert.That(it.MoveNext(), Is.False);
        }
Example #20
0
        public void _陳列された商品の表示依頼を処理する_お金を投入した場合()
        {
            var repo = new Ninject.StandardKernel()
                .BindPurchaseContextContainingSoldout()
                .BindRunnerRepository()
                .Get<IRunnerRepository>();

            Assert.That(repo.PurchaseContext.ReceivedTotal, Is.EqualTo(0));

            Action runner;
            this.TestShowItemCore(repo,
                "       # Name                     Price",
                "-----+--+------------------------+------",
                " [ ]   1 Item0...................   300",
                " [ ]   2 Item1...................  1200",
                " [-]   3 Item2...................   900",
                " [ ]   4 Item3...................   600"
            );

            var fixtures = new _コマンドパーサに渡すTestFixture().InsMoneyParams.Select(f => f.Expected);
            var money = fixtures.GetEnumerator();

            money.MoveNext();
            runner = repo.FindRunner(money.Current, null);
            runner();

            this.TestShowItemCore(repo,
                "       # Name                     Price",
                "-----+--+------------------------+------",
                " [*]   1 Item0...................   300",
                " [ ]   2 Item1...................  1200",
                " [-]   3 Item2...................   900",
                " [ ]   4 Item3...................   600"
            );

            money.MoveNext();
            runner = repo.FindRunner(money.Current, null);
            runner();

            this.TestShowItemCore(repo,
                "       # Name                     Price",
                "-----+--+------------------------+------",
                " [*]   1 Item0...................   300",
                " [ ]   2 Item1...................  1200",
                " [-]   3 Item2...................   900",
                " [*]   4 Item3...................   600"
            );

            money.MoveNext();
            runner = repo.FindRunner(money.Current, null);
            runner();

            this.TestShowItemCore(repo,
                "       # Name                     Price",
                "-----+--+------------------------+------",
                " [*]   1 Item0...................   300",
                " [*]   2 Item1...................  1200",
                " [-]   3 Item2...................   900",
                " [*]   4 Item3...................   600"
            );
        }
Example #21
0
        public void _投入合計金額表示を処理する_受け付けない金種を投入した場合()
        {
            var repo = new Ninject.StandardKernel()
                .BindPurchaseContext()
                    .BindRunnerRepository()
                    .Get<IRunnerRepository>()
                ;

            Action runner;
            var fixtures = new _コマンドパーサに渡すTestFixture().InvalidInsMoneyParams;
            foreach (var param in fixtures.Select(f => f.Expected)) {
                runner = repo.FindRunner(param, null);
                runner();

                var passed = false;
                runner = repo.FindRunner(new ShowAmountParseResult(), (message) => {
                    Assert.That(message, Is.EqualTo("Not received."));
                    passed = true;
                });
                runner();

                Assert.That(repo.PurchaseContext.ReceivedTotal, Is.EqualTo(0));
                Assert.That(passed, Is.True);
            }
        }
Example #22
0
        public void _陳列された商品の表示依頼を処理する_お金を投入した場合()
        {
            var repo = new Ninject.StandardKernel()
                       .BindPurchaseContextContainingSoldout()
                       .BindRunnerRepository()
                       .Get <IRunnerRepository>();

            Assert.That(repo.PurchaseContext.ReceivedTotal, Is.EqualTo(0));

            Action runner;

            this.TestShowItemCore(repo,
                                  "       # Name                     Price",
                                  "-----+--+------------------------+------",
                                  " [ ]   1 Item0...................   300",
                                  " [ ]   2 Item1...................  1200",
                                  " [-]   3 Item2...................   900",
                                  " [ ]   4 Item3...................   600"
                                  );

            var fixtures = new _コマンドパーサに渡すTestFixture().InsMoneyParams.Select(f => f.Expected);
            var money    = fixtures.GetEnumerator();

            money.MoveNext();
            runner = repo.FindRunner(money.Current, null);
            runner();

            this.TestShowItemCore(repo,
                                  "       # Name                     Price",
                                  "-----+--+------------------------+------",
                                  " [*]   1 Item0...................   300",
                                  " [ ]   2 Item1...................  1200",
                                  " [-]   3 Item2...................   900",
                                  " [ ]   4 Item3...................   600"
                                  );

            money.MoveNext();
            runner = repo.FindRunner(money.Current, null);
            runner();

            this.TestShowItemCore(repo,
                                  "       # Name                     Price",
                                  "-----+--+------------------------+------",
                                  " [*]   1 Item0...................   300",
                                  " [ ]   2 Item1...................  1200",
                                  " [-]   3 Item2...................   900",
                                  " [*]   4 Item3...................   600"
                                  );

            money.MoveNext();
            runner = repo.FindRunner(money.Current, null);
            runner();

            this.TestShowItemCore(repo,
                                  "       # Name                     Price",
                                  "-----+--+------------------------+------",
                                  " [*]   1 Item0...................   300",
                                  " [*]   2 Item1...................  1200",
                                  " [-]   3 Item2...................   900",
                                  " [*]   4 Item3...................   600"
                                  );
        }
Example #23
0
        public void _投入合計金額表示を処理する_未入金の場合()
        {
            var repo = new Ninject.StandardKernel()
                .BindPurchaseContext()
                    .BindRunnerRepository()
                    .Get<IRunnerRepository>()
                ;

            Assert.That(repo.PurchaseContext.ReceivedTotal, Is.EqualTo(0));

            var passed = false;
            var runner = repo.FindRunner(new ShowAmountParseResult(), (message) => {
                Assert.That(message, Is.EqualTo("Not received."));
                passed = true;
            });
            runner();

            Assert.That(repo.PurchaseContext.ReceivedTotal, Is.EqualTo(0));
            Assert.That(passed, Is.True);
        }
Example #24
0
        public void _お金の排出依頼を処理する()
        {
            var parameters = new _コマンドパーサに渡すTestFixture().InsMoneyParams
                .Select(p => p.Expected)
                .Cast<MoneyInsertionParseResult>()
            ;

            var repo = new Ninject.StandardKernel()
                .BindPurchaseContext()
                .BindRunnerRepository()
                .Get<IRunnerRepository>()
            ;

            Action runner;
            foreach (var parameter in parameters) {
                runner = repo.FindRunner(parameter, null);
                runner();
            }

            Assert.That(repo.PurchaseContext.ReceivedTotal, Is.GreaterThan(0));

            runner = repo.FindRunner(new MoneyEjectParseResult(), null);
            runner();

            Assert.That(repo.PurchaseContext.ReceivedTotal, Is.EqualTo(0));
        }
Example #25
0
        public void _陳列された商品の表示依頼を処理する_受け付けない金種を投入した場合()
        {
            var repo = new Ninject.StandardKernel()
                .BindPurchaseContextContainingSoldout()
                .BindRunnerRepository()
                .Get<IRunnerRepository>()
            ;

            Assert.That(repo.PurchaseContext.ReceivedTotal, Is.EqualTo(0));

            Action runner;
            var fixtures = new _コマンドパーサに渡すTestFixture().InvalidInsMoneyParams;
            foreach (var param in fixtures.Select(f => f.Expected)) {
                var expected = new string[] {
                    "       # Name                     Price",
                    "-----+--+------------------------+------",
                    " [ ]   1 Item0...................   300",
                    " [ ]   2 Item1...................  1200",
                    " [-]   3 Item2...................   900",
                    " [ ]   4 Item3...................   600"
                };
                var it = expected.GetEnumerator();

                runner = repo.FindRunner(param, null);
                runner();

                runner = repo.FindRunner(new ShowItemParseResult(), (message) => {
                    Assert.That(it.MoveNext(), Is.True);
                    Assert.That(message, Is.EqualTo(it.Current));
                });
                runner();

                Assert.That(it.MoveNext(), Is.False);
                Assert.That(repo.PurchaseContext.ReceivedTotal, Is.EqualTo(0));
            }
        }
Example #26
0
        public void _お金の排出依頼を処理する_入金がない場合()
        {
            var repo = new Ninject.StandardKernel()
                .BindPurchaseContext()
                    .BindRunnerRepository()
                    .Get<IRunnerRepository>()
                    ;

            Assert.That(repo.PurchaseContext.ReceivedTotal, Is.EqualTo(0));

            var passed = false;
            var runner = repo.FindRunner(new MoneyEjectParseResult(), (message) => {
                Assert.That(message, Is.EqualTo("money is not inserted."));
                passed = true;
            });
            runner();

            Assert.That(repo.PurchaseContext.ReceivedTotal, Is.EqualTo(0));

            Assert.That(passed, Is.True);
        }
Example #27
0
        public void _陳列された商品の表示依頼を処理する_釣り銭切れが解消するまでは購入不可となる場合()
        {
            var repo = new Ninject.StandardKernel()
                .BindNoChangeContext()
                .BindRunnerRepository()
                .Get<IRunnerRepository>()
            ;

            Assert.That(repo.PurchaseContext.ReceivedTotal, Is.EqualTo(0));

            Action runner;

            runner = repo.FindRunner(new MoneyInsertionParseResult {Money = Money.Coin500, Count=1}, null);
            runner();

            this.TestShowItemCore(repo,
                "       # Name                     Price",
                "-----+--+------------------------+------",
                " [!]   1 Item0...................   120",
                " [x]   2 ........................      ",
                " [!]   3 Item2...................   250"
            );

            runner = repo.FindRunner(new MoneyInsertionParseResult {Money = Money.Coin100, Count=1}, null);
            runner();
            runner = repo.FindRunner(new MoneyInsertionParseResult {Money = Money.Coin10, Count=3}, null);
            runner();

            this.TestShowItemCore(repo,
                "       # Name                     Price",
                "-----+--+------------------------+------",
                " [*]   1 Item0...................   120",
                " [x]   2 ........................      ",
                " [!]   3 Item2...................   250"
            );
        }
Example #28
0
        public void _パースされた投入金額を処理する(
            [ValueSource(typeof(_コマンドパーサに渡すTestFixture), "InsMoneyParams")] _コマンドパーサに渡すTestFixture.Parameter inParameter)
        {
            var repo = new Ninject.StandardKernel()
                .BindPurchaseContext()
                .BindRunnerRepository()
                .Get<IRunnerRepository>()
            ;

            var runner = repo.FindRunner(inParameter.Expected, null);

            runner();

            var expected = (MoneyInsertionParseResult)inParameter.Expected;
            Assert.That(repo.PurchaseContext.ReceivedTotal, Is.EqualTo(expected.Money.Value() * expected.Count));
        }