Example #1
0
        public async Task When_There_Is_No_Message_In_The_Sql_Command_Store_Get_Async()
        {
            Guid commandId = Guid.NewGuid();
            var  exception = await Catch.ExceptionAsync(() => _sqlCommandStore.GetAsync <MyCommand>(commandId, _contextKey));

            exception.Should().BeOfType <CommandNotFoundException <MyCommand> >();
        }
        public async Task When_There_Is_No_Message_In_The_Sql_Command_Store_Async()
        {
            _storedCommand = await _sqlCommandStore.GetAsync <MyCommand>(Guid.NewGuid());

            //_should_return_an_empty_command_on_a_missing_command
            _storedCommand.Id.Should().Be(Guid.Empty);
        }
Example #3
0
        public void When_There_Is_No_Message_In_The_Sql_Command_Store_Async()
        {
            _storedCommand = AsyncContext.Run <MyCommand>(async() => await _sqlCommandStore.GetAsync <MyCommand>(Guid.NewGuid()));

            //_should_return_an_empty_command_on_a_missing_command
            Assert.AreEqual(Guid.Empty, _storedCommand.Id);
        }
Example #4
0
        public void When_Writing_A_Message_To_The_Command_Store_Async()
        {
            AsyncContext.Run(async() => _storedCommand = await _sqlCommandStore.GetAsync <MyCommand>(_raisedCommand.Id));

            //_should_read_the_command_from_the__sql_command_store
            Assert.NotNull(_storedCommand);
            //_should_read_the_command_value
            Assert.AreEqual(_raisedCommand.Value, _storedCommand.Value);
            //_should_read_the_command_id
            Assert.AreEqual(_raisedCommand.Id, _storedCommand.Id);
        }
Example #5
0
        public async Task When_There_Is_No_Message_In_The_Sql_Command_Store_Async()
        {
            Guid commandId = Guid.NewGuid();

            _storedCommand = await _sqlCommandStore.GetAsync <MyCommand>(commandId);

            //_should_return_an_empty_command_on_a_missing_command
            _storedCommand.Id.Should().Be(Guid.Empty);

            bool exists = await _sqlCommandStore.ExistsAsync <MyCommand>(commandId);

            exists.Should().BeFalse();
        }
Example #6
0
        public async Task When_Writing_A_Message_To_The_Command_Store_Async()
        {
            await _sqlCommandStore.AddAsync(_raisedCommand, _contextKey);

            _storedCommand = await _sqlCommandStore.GetAsync <MyCommand>(_raisedCommand.Id, _contextKey);

            //_should_read_the_command_from_the__sql_command_store
            _storedCommand.Should().NotBeNull();
            //_should_read_the_command_value
            _storedCommand.Value.Should().Be(_raisedCommand.Value);
            //_should_read_the_command_id
            _storedCommand.Id.Should().Be(_raisedCommand.Id);
        }