Beispiel #1
0
        public void GetIndexFromAddress_NonExistingAddress_ReturnsInvalidIndex(string address)
        {
            TestablePlcService tps = new TestablePlcService(0, new TestableCpuConfig(), new List <Models.IDatablockModel>());

            (int, int)result = tps.GetIndexFromAddress(address, GetFakeDatablockModels());
            Assert.Equal((-1, -1), result);
        }
Beispiel #2
0
        public void GetIndexFromAddress_ExistingAddress_ReturnsValidIndex()
        {
            TestablePlcService tps = new TestablePlcService(0, new TestableCpuConfig(), new List <Models.IDatablockModel>());

            List <IDatablockModel> datablocks = GetFakeDatablockModels();

            for (int i = 0; i < datablocks.Count; i++)
            {
                for (int j = 0; j < datablocks[i].Signals.Count; j++)
                {
                    (int, int)result = tps.GetIndexFromAddress(datablocks[i].Signals[j].Address, datablocks);
                    Assert.Equal((i, j), result);
                }
            }
        }
Beispiel #3
0
        public void AddressIsBoolType_InvalidAddress_ReturnsFalse(string address)
        {
            TestablePlcService tps = new TestablePlcService(0, new TestableCpuConfig(), new List <Models.IDatablockModel>());

            Assert.True(!tps.AddressIsBoolType(address));
        }