Ejemplo n.º 1
0
        public void GetOpenTablesResponse_OnValidResponse_ReturnObjects()
        {
            // arrange
            var openTablesEntries = new List <OpenTablesEntry>();
            var openTablesEntry   = new OpenTablesEntry();

            openTablesEntry.TableId = "1";
            openTablesEntry.Label   = "1";
            openTablesEntry.BillOutstandingAmount = 2000;
            openTablesEntries.Add(openTablesEntry);

            openTablesEntry         = new OpenTablesEntry();
            openTablesEntry.TableId = "2";
            openTablesEntry.Label   = "2";
            openTablesEntry.BillOutstandingAmount = 2500;
            openTablesEntries.Add(openTablesEntry);

            // act
            var getOpenTablesResponse = new GetOpenTablesResponse();

            getOpenTablesResponse.OpenTablesEntries = openTablesEntries;
            var m = getOpenTablesResponse.ToMessage("1234");
            var getOpenTablesArray = (JArray)m.Data["tables"];
            var getOpenTablesList  = getOpenTablesArray.ToObject <List <OpenTablesEntry> >();

            // assert
            Assert.Equal(openTablesEntries.Count, getOpenTablesList.Count);
            Assert.Equal(2, openTablesEntries.Count);
        }
Ejemplo n.º 2
0
        public void GetOpenTables_OnValidResponseNull_IsSet()
        {
            // arrange
            var getOpenTablesResponse = new GetOpenTablesResponse();

            // act
            var openTablesEntriesResponse = getOpenTablesResponse.GetOpenTables();

            // assert
            Assert.NotNull(openTablesEntriesResponse);
            Assert.Null(getOpenTablesResponse.OpenTablesEntries);
        }
Ejemplo n.º 3
0
        public void GetOpenTables_OnValidResponse_IsSet()
        {
            // arrange
            var openTablesEntries = new List <OpenTablesEntry>();
            var openTablesEntry   = new OpenTablesEntry();

            openTablesEntry.TableId = "1";
            openTablesEntry.Label   = "1";
            openTablesEntry.BillOutstandingAmount = 2000;
            openTablesEntries.Add(openTablesEntry);

            // act
            var getOpenTablesResponse = new GetOpenTablesResponse();

            getOpenTablesResponse.OpenTablesEntries = openTablesEntries;
            var openTablesEntriesResponse = getOpenTablesResponse.GetOpenTables();

            // assert
            Assert.Equal(openTablesEntries.Count, openTablesEntriesResponse.Count);
        }