예제 #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
        public void TestSaveComplexData()
        {
            StubDataStore stubDataStore = new StubDataStore();
            SimpleService simpleServiceToTest = new SimpleService(stubDataStore);

            var complexData = TestUtils.GetRandomComplexData();

            simpleServiceToTest.SaveComplexData(complexData);
        }
예제 #3
0
        public void TestSaveNullComplexDataSet()
        {
            StubDataStore stubDataStore = new StubDataStore();
            SimpleService simpleServiceToTest = new SimpleService(stubDataStore);

            Assert.Throws(typeof(ArgumentNullException), () =>
             {
                 simpleServiceToTest.BulkSaveComplexData(null);
             });
        }
예제 #4
0
        public void TestNullSaveSimpleData()
        {
            StubDataStore stubDataStore = new StubDataStore();
            SimpleService simpleServiceToTest = new SimpleService(stubDataStore);

            Assert.Throws(typeof(ArgumentNullException), () =>
            {
                simpleServiceToTest.SaveSimpleData(null);
            });
        }
예제 #5
0
        public void ServiceSaveSimple()
        {
            StubDataStore stubDataStore = new StubDataStore();

            SimpleService simpleServiceToTest = new SimpleService(stubDataStore);

            Guid theID = Guid.NewGuid();

            var simpleData = new SimpleData(theID, "test1", 1000);

            simpleServiceToTest.SaveSimpleData(simpleData);

            var dataBack = simpleServiceToTest.GetSimpleData(theID);

            Assert.Equal(simpleData, dataBack);
        }
예제 #6
0
        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);
        }
예제 #7
0
        public void ServiceSaveComplex()
        {
            StubDataStore stubDataStore = new StubDataStore();

            SimpleService simpleServiceToTest = new SimpleService(stubDataStore);

            Guid theID = Guid.NewGuid();

            var complexData = TestUtils.GetRandomComplexData(10, 50);
            complexData.Id = theID;

            simpleServiceToTest.SaveComplexData(complexData);

            var dataBack = simpleServiceToTest.GetComplexData(theID);

            Assert.Equal(complexData, dataBack);
        }
예제 #8
0
        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);
        }