コード例 #1
0
        [TestCase(4, "Ok", 0)]    // zero qty
        public void ShouldReturnNull_WhenInvalidInput(decimal price, string name, int qty)
        {
            IAnalysis result = new AnalysisBuilder()
                               .SetClosingPrice(price)
                               .SetName(name)
                               .SetQtyInBuyingPacket(qty)
                               .SetTechnicalAnalysis(new TechnicalAnalysisBuilder()
                                                     .SetFastSMA(1)
                                                     .SetSlowSMA(2)
                                                     .Build())
                               .Build();

            result.Should().BeNull();
        }
コード例 #2
0
        public void ShouldReturnValidObject_WhenValidInput(decimal price, string name, int qty)
        {
            ITechnicalAnalysis technicalAnalysis = new TechnicalAnalysisBuilder()
                                                   .SetFastSMA(1)
                                                   .SetSlowSMA(2)
                                                   .Build();

            IAnalysis result = new AnalysisBuilder()
                               .SetClosingPrice(price)
                               .SetName(name)
                               .SetQtyInBuyingPacket(qty)
                               .SetTechnicalAnalysis(technicalAnalysis)
                               .Build();

            result.Should().NotBeNull();
            result.ClosingPrice.Should().Be(price);
            result.Name.Should().Be(name);
            result.QtyInBuyingPacket.Should().Be(qty);
            result.TechnicalAnalysis.Should().Be(technicalAnalysis);
        }