public async Task AppendEvent_Unconstrained_TestMethod()
        {
            TableEventStreamWriter testObj = new TableEventStreamWriter(new EventStreamAttribute("Domain Test", "Entity Type Test", "Instance 123"),
                                                                        "RetailBank");

            MockEventOne testEvent = new MockEventOne()
            {
                EventTypeName = "Test Event Happened"
            };

            testEvent.EventPayload = new MockEventOnePayload()
            {
                StringProperty = "This is some data", IntegerProperty = 123
            };

            await testObj.AppendEvent(eventInstance : testEvent);

            Assert.IsNotNull(testObj);
        }
        public async Task AppendEvent__Instance2_Unconstrained_TestMethod()
        {
            TableEventStreamWriter testObj = new TableEventStreamWriter(new EventStreamAttribute("Domain Test", "Entity Type Test", "Instance 456"),
                                                                        "RetailBank");

            MockEventOne testEvent = new MockEventOne()
            {
                EventTypeName = "Testing Event"
            };

            testEvent.EventPayload = new MockEventOnePayload()
            {
                StringProperty = "This is some data for the new instance", IntegerProperty = 234, dateTimeProperty = DateTime.UtcNow
            };

            await testObj.AppendEvent(eventInstance : testEvent);

            Assert.IsNotNull(testObj);
        }
        public async Task CreateNew_TestMethod()
        {
            bool expected = true;
            bool actual   = false;

            EventStream testObj = new EventStream(new EventStreamAttribute("Bank",
                                                                           "Account", Guid.NewGuid().ToString()));

            MockEventOne testEvent = new MockEventOne()
            {
                EventTypeName = "Another test Event Happened"
            };

            await testObj.AppendEvent(testEvent);

            actual = await testObj.Exists();

            Assert.AreEqual(expected, actual);
        }
        public async Task Append_Event_TestMethod()
        {
            bool expected = true;
            bool actual   = false;

            EventStream testObj = new EventStream(new EventStreamAttribute("Bank",
                                                                           "Account", "Instance 1234"));

            MockEventOne testEvent = new MockEventOne()
            {
                EventTypeName = "Test Event Happened"
            };

            await testObj.AppendEvent(testEvent);

            actual = await testObj.Exists();

            Assert.AreEqual(expected, actual);
        }
        public void MakeDynamicTableEntity_Valid_TestMethod()
        {
            MockEventOne testEvent = new MockEventOne()
            {
                EventTypeName = "Tested Event"
            };

            testEvent.EventPayload = new MockEventOnePayload()
            {
                StringProperty = "This is a test", dateTimeProperty = DateTime.Now
            };

            TableEventStreamWriter tsw = new TableEventStreamWriter(new EventStreamAttribute("Domain Test", "Entity Type Test", "Instance 123"),
                                                                    "RetailBank");

            var testObj = tsw.MakeDynamicTableEntity(testEvent, 123);

            Assert.IsNotNull(testObj);
        }
        public async Task AppendEvent_MustExist_TestMethod()
        {
            TableEventStreamWriter testObj = new TableEventStreamWriter(new EventStreamAttribute("Domain Test", "Entity Type Test", "Instance 123"),
                                                                        "RetailBank");

            MockEventOne testEvent = new MockEventOne()
            {
                EventTypeName = "Test Event Happened"
            };

            testEvent.EventPayload = new MockEventOnePayload()
            {
                StringProperty = "This is some data", IntegerProperty = 123
            };

            await testObj.AppendEvent(eventInstance : testEvent,
                                      streamConstraint : Common.EventSourcing.Implementation.EventStreamBase.EventStreamExistenceConstraint.MustExist);

            Assert.IsNotNull(testObj);
        }
        public async Task AppendEvent_ConcurrencyCrocodile_Fail_TestMethod()
        {
            TableEventStreamWriter testObj = new TableEventStreamWriter(new EventStreamAttribute("Bank", "Account", "Instance 1234"),
                                                                        "RetailBank");

            MockEventOne testEvent = new MockEventOne()
            {
                EventTypeName = "Test Event Happened"
            };

            testEvent.EventPayload = new MockEventOnePayload()
            {
                StringProperty = "This is some data", IntegerProperty = 123
            };

            await testObj.AppendEvent(eventInstance : testEvent,
                                      expectedTopSequenceNumber : 2);

            Assert.IsNotNull(testObj);
        }
        public async Task AppendEvent_Constrained_TestMethod()
        {
            TableEventStreamWriter testObj = new TableEventStreamWriter(new EventStreamAttribute("Domain Test", "Entity Type Test", "Instance 123"),
                                                                        "RetailBank");

            MockEventOne testEvent = new MockEventOne()
            {
                EventTypeName = "Failing event"
            };

            testEvent.EventPayload = new MockEventOnePayload()
            {
                StringProperty = "This is some more data", IntegerProperty = 123
            };

            // This is meant to fail as there are more than 1 events in this stream
            await testObj.AppendEvent(eventInstance : testEvent,
                                      expectedTopSequenceNumber : 1);

            Assert.IsNotNull(testObj);
        }