public void ThrowIfDeviceInstanceExists( [Frozen] ImagingDeviceConfig deviceConfig, [Frozen] ScannerSettings settings, [Frozen, CollectionSize(1)] IEnumerable <ScannerSettings> _, [Greedy] ScanningDevices sut) { var existingInstance = new ScanningDevice(settings, deviceConfig); sut.Invoking(x => x.AddDevice(existingInstance)) .Should().Throw <ArgumentException>(); sut.Devices.Should() .HaveCount(1) .And.OnlyHaveUniqueItems() .And.Contain(i => i.DeviceID == existingInstance.DeviceID); }
public void ContainUniqueDevices( ScanningDevice device, [Frozen] ImagingDeviceConfig deviceConfig, [Frozen, CollectionSize(5)] IEnumerable <ScannerSettings> scannerSettings, [Greedy] ScanningDevices sut) { var scanningDevices = scannerSettings.Select(x => new ScanningDevice(x, deviceConfig)); sut.AddDevice(device); sut.Devices.Should() .HaveCount(6) .And.OnlyHaveUniqueItems() .And.Contain(scanningDevices) .And.Contain(i => i.DeviceID == device.DeviceID); }