public void SlaveServiceDeleteUser_CorrectUser()
 {
     var client = new Client(appDomainSetup);
     var user = new User("Alex", "Alex", DateTime.Now, 123, Gender.Male, null);
     var user1 = new User("Ben", "Larrson", DateTime.Now, 357, Gender.Male, null);
     client.Proxy.Add(user);
     client.Proxy.Add(user1);
     client.Services[1].Delete(1);
 }
 public void MasterServiceSearchUser_ISearchCriteria_ReturnUserIds()
 {
     var client = new Client(appDomainSetup);
     var user = new User("Alex", "Alex", DateTime.Now, 123, Gender.Male, null);
     var user1 = new User("Ben", "Larrson", DateTime.Now, 357, Gender.Male, null);
     client.Proxy.Add(user);
     client.Proxy.Add(user1);
     Thread.Sleep(3000);
     Assert.AreEqual(1, client.Services[0].SearchForUser(new SearchByFirstName("Alex")).First());
 }
Пример #3
0
        static void Main(string[] args)
        {
            Assembly.GetExecutingAssembly().AutomapNamespace("Tests");

            var userVm = new EditUserVM() { FirstName = "Borislav", LastName = "Rangelov", Details="*****@*****.**" };
            var user = new User();
            Mapper.Map(userVm, user);

            Console.WriteLine(user.FirstName);
            Console.ReadKey(true);
        }
Пример #4
0
        public void Init()
        {
            blog1 = new Blog("blabla1", "blablbal2");
            blog2 = new Blog("blabla1", "blablbal2");
            blog3 = new Blog("blabla1", "blablbal2");

            tag1 = new Tag("test tag 1");
            tag2 = new Tag("test tag 2");
            tag3 = new Tag("test tag 3");
            tag4 = new Tag("test tag 4");

            u1 = new User("Ivo", "Katunarić", 25);
            u2 = new User("Ivo", "Katunarić", 25);
            u3 = new User("Ivo", "Katunarić", 25);
        }
Пример #5
0
        public void Init()
        {
            user1 = new User("Ivo", "Katunarić", 25);
            user2 = new User("Ivo", "Katunarić", 25);
            user3 = new User("Ivo", "Katunarić", 25);

            blog1 = new Blog("Test blog1", "This is sie text of my blog1");
            blog2 = new Blog("Test blog1", "This is sie text of my blog1");
            blog3 = new Blog("Test blog1", "This is sie text of my blog1");
            blog4 = new Blog("Test blog1", "This is sie text of my blog1");
        }
 public void ServiceAsyncWork_ISearchCriteria_ReturnNoId()    // no thread sleep so service can't add user to local repository in time
 {
     var client = new Client(appDomainSetup);
     var user = new User("Alex", "Alex", DateTime.Now, 123, Gender.Male, null);
     var user1 = new User("Ben", "Larrson", DateTime.Now, 357, Gender.Male, null);
     client.Proxy.Add(user);
     client.Proxy.Add(user1);
     Assert.AreNotEqual(1, client.Services[0].SearchForUser(new SearchByFirstName("Alex")).Count()); 
 }
 public void SlaveServiceAddUser_CorrectUser_ReturnId()
 {
     var client = new Client(appDomainSetup);
     var user = new User("Alex", "Alex", DateTime.Now, 123, Gender.Male, null);
     Assert.AreEqual(typeof(int), client.Services[1].Add(user).GetType());
 }
 public void Service_IncorrectUser_ValidationException()
 {
     var client = new Client(appDomainSetup);
     var user = new User("Alex", " ", DateTime.Now, 123, Gender.Male, null);
     client.Proxy.Add(user);
 }
 public void MasterServiceSearchUser_ISearchCriteriaS_ReturnUserIds()
 {
     var client = new Client(appDomainSetup);
     var user = new User("Alex", "Alex", DateTime.Now, 123, Gender.Male, null);
     var user1 = new User("Alex", "Larrson", DateTime.Now, 357, Gender.Male, null);
     var user2 = new User("Alex", "jackson", DateTime.Now, 377, Gender.Female, null);
     client.Proxy.Add(user);
     client.Proxy.Add(user1);
     client.Proxy.Add(user2);
     Thread.Sleep(3000);
     var results = client.Proxy.SearchForUser(new SearchByFirstName("Alex"), new SearchByGender(Gender.Male));
     IEnumerable<int> expectedResult = new List<int>() { 1, 2 };
     Assert.AreEqual(true, results.SequenceEqual(expectedResult));
 }
Пример #10
0
        public MemContext()
        {
            var account = new Account
            {
                Id = 1,
                Name = "My Test Account",
                Paid = true,
                PaidUtc = new DateTime(2016, 1, 1),
            };
            Accounts.Add(account);
            var user = new User
            {
                Id = 1,
                Name = "Joe User",
                AccountId = 1,
                Account = account,
                Active = true
            };
            Users.Add(user);
            account.Users = new List<User> { user };
            var account2 = new Account
            {
                Id = 2,
                Name = "Another Test Account",
                Paid = false
            };
            Accounts.Add(account2);
            var user2 = new User
            {
                Id = 2,
                Name = "Late Paying User",
                AccountId = 2,
                Account = account2
            };
            Users.Add(user2);
            MutateMes.Add(new MutateMe
            {
                Id = 1,
                Value = 0,
            });
            account2.Users = new List<User> { user2 };

            var human = new Human
            {
                Id = 1,
                Name = "Han Solo",
                Height = 5.6430448
            };
            Heros.Add(human);
            var stormtrooper = new Stormtrooper
            {
                Id = 2,
                Name = "FN-2187",
                Height = 4.9,
                Specialization = "Imperial Snowtrooper"
            };
            Heros.Add(stormtrooper);
            var droid = new Droid
            {
                Id = 3,
                Name = "R2-D2",
                PrimaryFunction = "Astromech"
            };
            Heros.Add(droid);

            var vehicle = new Vehicle
            {
                Id = 1,
                Name = "Millennium falcon",
                OwnerId = human.Id
            };
            Vehicles.Add(vehicle);
            human.Vehicles = new List<Vehicle> { vehicle };
            var vehicle2 = new Vehicle
            {
                Id = 2,
                Name = "Speeder bike",
                OwnerId = stormtrooper.Id
            };
            Vehicles.Add(vehicle2);
            stormtrooper.Vehicles = new List<Vehicle> { vehicle2 };
        }