コード例 #1
0
        public void IsBandColorValid()
        {
            var mockPieRepository = new ResistorBandRepository();

            ////arrange
            var  OhmsCalculatorService = new OhmsCalculatorService(mockPieRepository);
            bool isValid = OhmsCalculatorService.IsValid("Red", "Red", "Red", "Red");

            //assert
            Assert.True(isValid);
        }
コード例 #2
0
        public void OhmsCalculator2()
        {
            var mockPieRepository = new ResistorBandRepository();

            ////arrange
            var OhmsCalculatorService = new OhmsCalculatorService(mockPieRepository);
            var ohms = OhmsCalculatorService.CalculateOhmValue("Red", "Yellow", "DeepPink", "Red");

            //assert
            Assert.Equal(.024, ohms);
        }
コード例 #3
0
        public void RejectInvalidBandCColors(string color)
        {
            var mockPieRepository     = new ResistorBandRepository();
            var OhmsCalculatorService = new OhmsCalculatorService(mockPieRepository);

            ////arrange
            bool isValid = OhmsCalculatorService.IsValidBandCColor(color);

            //assert
            Assert.False(isValid);
        }
コード例 #4
0
        public void ShouldAcceptBandAColors(string color)
        {
            var mockPieRepository     = new ResistorBandRepository();
            var OhmsCalculatorService = new OhmsCalculatorService(mockPieRepository);

            ////arrange
            bool isValid = OhmsCalculatorService.IsValidBandABColor(color);

            //assert
            Assert.True(isValid);
        }
コード例 #5
0
        public void RejectInvalidInput(string bandAcolor, string bandBcolor, string bandCcolor, string bandDcolor)
        {
            var mockPieRepository = new ResistorBandRepository();

            ////arrange
            var OhmsCalculatorService = new OhmsCalculatorService(mockPieRepository);
            var ohms = OhmsCalculatorService.CalculateOhmValue(bandAcolor, bandBcolor, bandCcolor, bandDcolor);

            //assert
            Assert.Equal(-1, ohms);
        }
コード例 #6
0
        public void AcceptOhmsValueWYDB(string bandAcolor, string bandBcolor, string bandCcolor, string bandDcolor)
        {
            var mockPieRepository = new ResistorBandRepository();

            ////arrange
            var OhmsCalculatorService = new OhmsCalculatorService(mockPieRepository);
            var ohms = OhmsCalculatorService.CalculateOhmValue(bandAcolor, bandBcolor, bandCcolor, bandDcolor);

            //assert
            Assert.Equal(.094, ohms);
        }