Ejemplo n.º 1
0
        public async Task EnterNullBatteryType_ThrowsArgumentNullException()
        {
            BatteryType batteryType = null;
            var         service     = new BatteryService(_batteryRepositoryMock.Object, _batteryTypeRepositoryMock.Object, _batteryChargeRepositoryMock.Object, _loggerMock.Object);

            await Assert.ThrowsAsync <ArgumentNullException>(() => service.EnterNewBatteryTypeAsync(1, batteryType));
        }
Ejemplo n.º 2
0
        public async Task EnterNewBatteryType_CallsBatteryTypeRepositoryAdd()
        {
            var batteryType = new BatteryType {
                Type = "Graphene", Cells = 4, CapacityMah = 2200, WeightInGrams = 500, AccountId = 1
            };
            var service = new BatteryService(_batteryRepositoryMock.Object, _batteryTypeRepositoryMock.Object, _batteryChargeRepositoryMock.Object, _loggerMock.Object);

            await service.EnterNewBatteryTypeAsync(1, batteryType);

            _batteryTypeRepositoryMock.Verify(x => x.AddAsync(batteryType));
        }