コード例 #1
0
        public void ServiceSaveBulk()
        {
            StubDataStore stubDataStore = new StubDataStore();

            SimpleService simpleServiceToTest = new SimpleService(stubDataStore);

            List<ComplexData> cds = new List<ComplexData>();

            for (int i = 0; i < 100; i++)
            {
                Guid theID = Guid.NewGuid();

                string randomName = Utilities.RandomString(10);

                var complexData = new ComplexData(theID, randomName, new List<SubitemData>() { }, ComplexDataTypeEnum.Complex);

                cds.Add(complexData);
            }

            simpleServiceToTest.BulkSaveComplexData(cds);

            foreach (var cd in cds)
            {
                var retcd = simpleServiceToTest.GetComplexData(cd.Id);

                Assert.Equal(cd, retcd);
            }
        }
コード例 #2
0
ファイル: ServiceUnitTests.cs プロジェクト: orthros/MonCF
        public void TestSaveNullComplexDataSet()
        {
            StubDataStore stubDataStore = new StubDataStore();
            SimpleService simpleServiceToTest = new SimpleService(stubDataStore);

            Assert.Throws(typeof(ArgumentNullException), () =>
             {
                 simpleServiceToTest.BulkSaveComplexData(null);
             });
        }
コード例 #3
0
ファイル: ServiceUnitTests.cs プロジェクト: orthros/MonCF
        public void TestSaveComplexDataSet()
        {
            StubDataStore stubDataStore = new StubDataStore();
            SimpleService simpleServiceToTest = new SimpleService(stubDataStore);

            Random r = new Random((int)DateTime.Now.Ticks);
            var total = r.Next(1000);

            List<ComplexData> dataSet = new List<ComplexData>(total);

            for (int i = 0; i < total; i++)
            {
                dataSet.Add(TestUtils.GetRandomComplexData());
            }

            simpleServiceToTest.BulkSaveComplexData(dataSet);
        }
コード例 #4
0
ファイル: ServiceUnitTests.cs プロジェクト: orthros/MonCF
        public void TestSaveEmptyComplexDataSet()
        {
            StubDataStore stubDataStore = new StubDataStore();
            SimpleService simpleServiceToTest = new SimpleService(stubDataStore);

            List<ComplexData> dataSet = new List<ComplexData>();

            var thrownException = Assert.Throws(typeof(ArgumentException), () =>
             {
                 simpleServiceToTest.BulkSaveComplexData(dataSet);
             });

            Assert.IsType(typeof(ArgumentException), thrownException);
        }