Exemplo n.º 1
0
 public async Task <ulong> CreateOrUpdateCommandVariable(CommandVariable variable)
 {
     using (var db = await DbConnectionFactory.OpenAsync())
     {
         return(await db.CreateOrUpdateCommandVariable(variable));
     }
 }
        public async Task It_Should_Delete_Command_Variable()
        {
            // Arrange
            batchRepository.DoesBatchExist(Arg.Any <string>())
            .Returns(true);

            stepRepository.Get(Arg.Any <string>(), Arg.Any <string>())
            .Returns(new Step());

            commandRepository.Get(Arg.Any <ulong>(), Arg.Any <string>())
            .Returns(new Command());

            var existingCommandVariable = new CommandVariable
            {
                Id = 123
            };

            commandRepository.GetCommandVariable(Arg.Any <ulong>(), Arg.Any <string>())
            .Returns(existingCommandVariable);

            var request = new DeleteCommandVariableRequest();

            // Act
            var response = await Sut.Delete(request);

            // Assert
            response.Should().NotBeNull();
            await commandRepository.Received().DeleteCommandVariable(Arg.Is <ulong>(a =>
                                                                                    a == existingCommandVariable.Id));
        }
Exemplo n.º 3
0
        internal static async Task <ulong> CreateOrUpdateCommandVariable(this IDbConnection db, CommandVariable variable)
        {
            await db.SaveAsync(variable, true);

            return(variable.Id);
        }