public async Task PilotStorageCmdInteractor_UpdatePilotAsync_NullParameters()
        {
            var contestCmdInteractor = new PilotStorageCmdInteractor(mockPilotRepository.Object, mockLogger.Object);
            var result = await contestCmdInteractor.UpdatePilotAsync(null);

            Assert.IsTrue(result.IsFaulted);
        }
        public async Task PilotStorageCmdInteractor_UpdatePilotAsync_RepositoryFailure()
        {
            var fName     = "Rick";
            var lName     = "R";
            var amaNumber = "234235045";
            var airframe  = "snipe";

            var pilot = new Pilot(fName, lName, string.Empty, amaNumber, airframe);
            var pilotCmdInteractor = new PilotStorageCmdInteractor(mockPilotRepository.Object, mockLogger.Object);

            mockPilotRepository.Setup(p => p.UpdateAsync(It.IsAny <Pilot>())).Returns <Pilot>(x => Task.FromResult(new Result <Pilot>(null)));

            var result = await pilotCmdInteractor.UpdatePilotAsync(pilot);

            Assert.IsTrue(result.IsFaulted);
            Assert.IsNull(result.Value);
        }
        public async Task PilotStorageCmdInteractor_UpdatePilotAsync_BadPilotParameter()
        {
            var pilot = new Pilot(string.Empty, "foo", string.Empty);
            var pilotCmdInteractor = new PilotStorageCmdInteractor(mockPilotRepository.Object, mockLogger.Object);

            var result = await pilotCmdInteractor.CreateNewPilotAsync(pilot);

            // Check empty first name
            Assert.IsTrue(result.IsFaulted);

            pilot.FirstName = "bar";
            pilot.LastName  = string.Empty;

            result = await pilotCmdInteractor.UpdatePilotAsync(pilot);

            // Check empty last name
            Assert.IsTrue(result.IsFaulted);
            Assert.IsNull(result.Value);
        }
        public async Task PilotStorageCmdInteractor_UpdatePilotAsync_HappyPath()
        {
            var fName     = "Rick";
            var lName     = "R";
            var amaNumber = "234235045";
            var airframe  = "snipe";

            var pilot = new Pilot(fName, lName, string.Empty, amaNumber, airframe);
            var pilotCmdInteractor = new PilotStorageCmdInteractor(mockPilotRepository.Object, mockLogger.Object);

            mockPilotRepository.Setup(p => p.UpdateAsync(It.IsAny <Pilot>())).Returns <Pilot>(x => Task.FromResult(new Result <Pilot>(pilot)));

            var result = await pilotCmdInteractor.UpdatePilotAsync(pilot);

            Assert.IsFalse(result.IsFaulted);
            Assert.AreEqual(fName, result.Value.FirstName);
            Assert.AreEqual(lName, result.Value.LastName);
            Assert.AreEqual(amaNumber, result.Value.StandardsBodyId);
            Assert.AreEqual(airframe, result.Value.Airframe);
        }