Exemple #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);
        }
Exemple #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);
        }
Exemple #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);
        }
Exemple #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);
        }
        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);
        }
        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);
        }
Exemple #7
0
 public ResistorController(IResistorBandRepository resistorbandRepository)
 {
     _resistorbandRepository = resistorbandRepository;
     _ohmsCalculatorService  = new OhmsCalculatorService(_resistorbandRepository);
 }