public void GetCollection()
        {
            // Arrange
            var xmlContext = new XmlContext <XmlTestModel>(Options.Create(new XmlConfiguration()));
            var testModel  = CreateTestModel();

            // Act
            xmlContext.Add(testModel);
            xmlContext.SaveChanges();
            var result = xmlContext.GetCollection();

            // Assert
            result.FirstOrDefault(x => x.Name == testModel.Name).Should().NotBeNull();
        }
        public void Add_AddingMany_ManyAdded()
        {
            // Arrange
            var xmlContext = new XmlContext <XmlTestModel>(Options.Create(new XmlConfiguration()));
            var testModels = CreateTestModels();

            // Act
            xmlContext.Add(testModels);
            xmlContext.SaveChanges();
            var result = xmlContext.GetCollection();

            // Assert
            result.FirstOrDefault().Should().NotBeNull();
            result.Should().Contain(testModels);
        }
Beispiel #3
0
        public void GetCollection_StateUnderTest_ExpectedBehavior()
        {
            // Arrange
            var xmlContext = new XmlContext <XmlTestModel>(Options.Create(new XmlConfiguration()));

            // Act
            //var result = xmlContext.GetCollection();
            xmlContext.Add(new XmlTestModel()
            {
                Name        = "My Name",
                DateOfBirth = DateTime.UtcNow,
                Salary      = 100000
            });

            xmlContext.SaveChanges();
            _outputHelper.WriteLine(xmlContext.GetCollection().ToJson());

            // Assert
            Assert.True(true);
        }