Exemplo n.º 1
0
        public void ResultLogHelper_ToSelectListItemsTests_Valid_Only_Sequence_1_Should_Pass()
        {
            // Arrange
            // Add an item with sequence more than 1
            var newData = new ResultLogModel
            {
                ReadingSequence = 2,
                ID = "id"
            };

            DataSourceBackend.Instance.ResultLogBackend.Create(newData);

            var data = DataSourceBackend.Instance.ResultLogBackend.Index();

            // Act
            var result = ResultLogHelper.ToSelectListItems(data, null);
            var myItem = result.ToList().Find(m => m.Value == "id");

            // Reset
            DataSourceBackend.Instance.Reset();

            // Assert

            // Should not be in the list
            Assert.AreEqual(null, myItem);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Makes a new AvatarItem
        /// </summary>
        /// <param name="data"></param>
        /// <returns>AvatarItem Passed In</returns>
        public ResultLogModel Create(ResultLogModel data, DataSourceEnum dataSourceEnum = DataSourceEnum.Unknown)
        {
            if (data == null)
            {
                return(null);
            }

            dataset.Add(data);

            // Add to Storage
            var myResult = DataSourceBackendTable.Instance.Create <ResultLogModel>(tableName, partitionKey, data.ID, data, dataSourceEnum);

            return(data);
        }
Exemplo n.º 3
0
        public void ResultLog_Create_InValid_Null_Should_Fail()
        {
            // Arrange
            var myBackend = ResultLogRepositoryMock.Instance;
            var myData    = new ResultLogModel();

            // Act
            var result = myBackend.Create(null);

            // Reset
            myBackend.Reset();

            // Assert
            Assert.IsNull(result);
        }
Exemplo n.º 4
0
        public void ResultLog_Update_InValid_Bogus_Should_Fail()
        {
            // Arrange
            var myBackend  = ResultLogRepositoryMock.Instance;
            var myDataCopy = new ResultLogModel
            {
                ID = "bogus"
            };

            // Act
            var result = myBackend.Update(myDataCopy);

            // Reset
            myBackend.Reset();

            // Assert
            Assert.AreEqual(null, result);
        }
Exemplo n.º 5
0
        public void ResultLogHelper_ConvertIDtoString_Valid_Should_Pass()
        {
            // Arrange
            var data = new ResultLogModel
            {
                BilirubinValue = 55
            };

            DataSourceBackend.Instance.ResultLogBackend.Create(data);

            // Act
            var result = ResultLogHelper.ConvertIDtoString(data.ID);

            // Reset
            DataSourceBackend.Instance.Reset();

            // Assert
            Assert.AreEqual("55", result);
        }
Exemplo n.º 6
0
        public void ResultLog_Update_Default_Should_Pass()
        {
            // Arrange
            var myBackend = ResultLogRepositoryMock.Instance;
            var myData    = myBackend.Index().FirstOrDefault();

            // Make a Copy of the Data and update an aspect of it
            var myDataCopy = new ResultLogModel(myData);

            myDataCopy.ID       = myData.ID; // Force the ID to match for this test.
            myDataCopy.ClinicID = "New3";

            // Act
            var result = myBackend.Update(myDataCopy);

            // Reset
            myBackend.Reset();

            // Assert
            Assert.AreEqual("New3", result.ClinicID);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Update all attributes to be what is passed in
        /// </summary>
        /// <param name="data"></param>
        /// <returns>Null or updated data</returns>
        public ResultLogModel Update(ResultLogModel data)
        {
            if (data == null)
            {
                return(null);
            }

            var myReturn = Read(data.ID);

            if (myReturn == null)
            {
                return(null);
            }

            myReturn.Update(data);

            // Update Storage
            var myResult = DataSourceBackendTable.Instance.Create <ResultLogModel>(tableName, partitionKey, data.ID, data);

            return(data);
        }