Esempio n. 1
0
        public void ProteinCollection_Contains_ReturnsFalseWhenTheCollectionIsEmpty()
        {
            // Arrange
            var collection = new ProteinCollection();
            // Act
            bool result = collection.Contains(1);

            // Assert
            Assert.IsFalse(result);
        }
Esempio n. 2
0
        public void ProteinCollection_TryGetValue_ReturnsFalseWhenTheCollectionIsEmpty()
        {
            // Arrange
            var collection = new ProteinCollection();
            // Act
            bool result = collection.TryGetValue(1, out var protein);

            // Assert
            Assert.IsFalse(result);
            Assert.IsNull(protein);
        }
Esempio n. 3
0
        public void ProteinCollection_Contains_ReturnsTrueWhenTheKeyExists()
        {
            // Arrange
            var collection = new ProteinCollection
            {
                CreateValidProtein(1)
            };
            // Act
            bool result = collection.Contains(1);

            // Assert
            Assert.IsTrue(result);
        }
Esempio n. 4
0
        public void ProteinCollection_TryGetValue_ReturnsTrueWhenTheKeyExists()
        {
            // Arrange
            var collection = new ProteinCollection
            {
                CreateValidProtein(1)
            };
            // Act
            bool result = collection.TryGetValue(1, out var protein);

            // Assert
            Assert.IsTrue(result);
            Assert.IsNotNull(protein);
        }
Esempio n. 5
0
        public void ProteinCollection_Ctor_FromProjectSummary()
        {
            // Arrange
            var client = new WebClient();

            using (var stream = new MemoryStream(client.DownloadData(ProjectSummaryUrl.Json)))
            {
                stream.Position = 0;
                var deserializer = new ProjectSummaryJsonDeserializer();
                var proteins     = deserializer.Deserialize(stream);
                var collection   = new ProteinCollection(proteins);
                Assert.IsTrue(collection.Count > 0);
            }
        }
Esempio n. 6
0
        public void ProteinCollection_Ctor_AddsValidProteins()
        {
            // Arrange
            var proteins = new List <Protein>
            {
                CreateValidProtein(1),
                CreateValidProtein(2),
                new Protein {
                    ProjectNumber = 3
                }
            };
            // Act
            var collection = new ProteinCollection(proteins);

            // Assert
            Assert.AreEqual(2, collection.Count);
            Assert.AreEqual(1, collection[1].ProjectNumber);
            Assert.AreEqual(2, collection[2].ProjectNumber);
        }
Esempio n. 7
0
        public void ProteinCollection_Update_AddsValidProteins()
        {
            // Arrange
            var proteins = new List <Protein>
            {
                CreateValidProtein(1),
                CreateValidProtein(2),
                new Protein {
                    ProjectNumber = 3
                }
            };
            var collection = new ProteinCollection();
            // Act
            var changes = collection.Update(proteins);

            // Assert
            Assert.AreEqual(2, changes.Count);
            Assert.AreEqual(1, changes[0].ProjectNumber);
            Assert.AreEqual(ProteinChangeAction.Add, changes[0].Action);
            Assert.IsNull(changes[0].PropertyChanges);
            Assert.AreEqual(2, changes[1].ProjectNumber);
            Assert.AreEqual(ProteinChangeAction.Add, changes[1].Action);
            Assert.IsNull(changes[1].PropertyChanges);
        }