예제 #1
0
		public override void Execute( AutoData parameter )
		{
			foreach ( var customization in factory( parameter.Method ) )
			{
				customization.Customize( parameter.Fixture );
			}
		}
예제 #2
0
        private void TestCreate <T>()
        {
            var value = AutoData.Create <T>();

            if (value == null)
            {
                throw new Exception("null");
            }
            Logger.LogDebug(value.Stringify());
        }
        public async Task Test_One_Item()
        {
            var list       = AutoData.Create <ContractDetails>(1);
            var listOfList = new List <List <ContractDetails> > {
                list
            };
            var cd = await listOfList.ToObservable().ContractDetailsSingle();

            Write(cd.Stringify());
        }
예제 #4
0
        public void Test_1()
        {
            var c1 = AutoData.Create <ContractData>();
            var c2 = AutoData.Create <ContractData>();

            Logger.LogDebug(c1.Stringify());
            Logger.LogDebug("");
            Logger.LogDebug(c2.Stringify());

            Assert.NotEqual(c1.Stringify(), c2.Stringify());
        }
        public async Task Test_Multiple()
        {
            var list       = AutoData.Create <ContractDetails>(2);
            var listOfList = new List <List <ContractDetails> > {
                list
            };
            var cd = listOfList.ToObservable().ContractDetailsSingle();
            var ex = await Assert.ThrowsAsync <InvalidDataException>(async() => await cd);

            ex.WriteMessageTo(Write);
        }
예제 #6
0
    public void _20_3_AutoGeneratorDescriptorOfEmptyTimeline()
    {
        var basePath          = Path.Combine(Application.dataPath, "AutomatineTest/TestGenerated/Editor");
        var autoGenOutputPath = Path.Combine(basePath, "_20_3_AutoGeneratorDescriptorOfEmptyTimeline.json");

        {
            // write to json file.
            var classGenParam = new AutoData(
                "2016/01/06 16:55:06",
                "Auto_Default3",
                "autoInfo",
                new List <string> {
                "複数行のコメント", "描きたいですね。"
            },

                new List <TimelineData> {
                new TimelineData(
                    "2016/01/06 16:55:06",
                    "timelineInfo_0"
                    )
            }
                );

            var serialized = JsonUtility.ToJson(classGenParam);


            // write json file
            using (var sw = new StreamWriter(autoGenOutputPath))
            {
                sw.Write(serialized);
            }
        }

        {
            // read json file
            var body = string.Empty;
            using (var sr = new StreamReader(autoGenOutputPath))
            {
                body = sr.ReadToEnd();
            }
            var deserialized = JsonUtility.FromJson <AutoData>(body);

            var desc = AutoDescriptor.Auto("<InitialParamType, UpdateParamType>", deserialized);

            var outputPath = Path.Combine(basePath, "_20_3_AutoGeneratorDescriptorOfEmptyTimeline.cs");

            // write class file
            using (var sw = new StreamWriter(outputPath))
            {
                sw.Write(desc);
            }
        }
    }
예제 #7
0
 public void AutoTypeAndStringify()
 {
     foreach (var type in types.Where(t =>
                                      t.IsClass && t.IsSealed &&
                                      t.Namespace != null && t.Namespace.Contains(".Messages")).ToList())
     {
         try
         {
             var instance = AutoData.Create(type);
             Assert.NotNull(instance);
             var str = instance !.Stringify();
             Logger.LogDebug(str + "\n");
         }
         catch (Exception e)
         {
             Logger.LogError(e, $"Type: {type.Name}");
             throw;
         }
     }
 }
예제 #8
0
    public void _20_1_AutoGeneratorDescriptorFromJson()
    {
        var basePath          = Path.Combine(Application.dataPath, "AutomatineTest/TestGenerated/Editor");
        var autoGenOutputPath = Path.Combine(basePath, "_20_1_AutoGeneratorDescriptorFromJson.json");

        {
            // write to json file.
            var classGenParam = new AutoData(
                "2016/01/06 16:55:06",
                "Auto_Default1",
                "autoInfo",
                new List <string> {
                "複数行のコメント", "描きたいですね。"
            },

                new List <TimelineData> {
                new TimelineData(
                    "2016/01/06 16:55:06",
                    "timelineInfo_0",
                    new List <TackData> {
                    new TackData(
                        "id",
                        "tackInfo_0",
                        0,
                        1,
                        "Act",
                        "DEFAULT",
                        new List <string> {
                        "Default", "_Infinity"
                    }
                        ),
                    new TackData(
                        "id0",
                        "tackInfo_1",
                        1,
                        10,
                        "Act",
                        "P0",
                        new List <string> {
                        "Default"
                    }
                        )
                }
                    ),
                new TimelineData(
                    "2016/01/06 16:55:86",
                    "timelineInfo_1",
                    new List <TackData> {
                    new TackData(
                        "id1",
                        "tackInfo_2",
                        0,
                        20,
                        "Anim",
                        "DEFAULT",
                        new List <string> {
                        "Default"
                    }
                        ),
                    new TackData(
                        "id2",
                        "tackInfo_3",
                        20,
                        100,
                        "Anim",
                        "SPAWN",
                        new List <string> {
                        "Default"
                    }
                        )
                }
                    )
            }
                );

            var serialized = JsonUtility.ToJson(classGenParam);


            // write json file
            using (var sw = new StreamWriter(autoGenOutputPath))
            {
                sw.Write(serialized);
            }
        }

        {
            // read json file
            var body = string.Empty;
            using (var sr = new StreamReader(autoGenOutputPath))
            {
                body = sr.ReadToEnd();
            }
            var deserialized = JsonUtility.FromJson <AutoData>(body);

            var desc = AutoDescriptor.Auto("<InitialParamType, UpdateParamType>", deserialized);


            var outputPath = Path.Combine(basePath, "_20_1_AutoGeneratorDescriptorFromJson.cs");

            // write class file
            using (var sw = new StreamWriter(outputPath))
            {
                sw.Write(desc);
            }
        }
    }