public void testEnumUShort1() { instanceEnumUShort = EnumUShort.V3; staticEnumUShort = EnumUShort.V2; var local = EnumUShort.V2; AssertTrue(instanceEnumUShort == EnumUShort.V3); AssertTrue(staticEnumUShort == EnumUShort.V2); AssertTrue(local == EnumUShort.V2); var arr = new EnumUShort[1]; arr[0] = EnumUShort.V2; AssertTrue(arr[0] == EnumUShort.V2); }
public async Task EnumUShortTestAsync(EnumUShort value) { var collection = MongoDatabase.GetCollection <TestModel>("TestModel"); var testModel = TestModelFactory.GetModel(); await collection.InsertOneAsync(testModel); var result = await collection.UpdateManyAsync(t => t.Id == testModel.Id, () => new TestModel { EnumUShort = value }); Assert.Equal(1L, testModel.EnumUShort == value ? result.MatchedCount : result.ModifiedCount); var modifyModel = collection.AsQueryable().First(p => p.Id == testModel.Id); Assert.Equal(value, modifyModel.EnumUShort); Assert.Equal(1L, (await collection.DeleteOneAsync(t => t.Id == testModel.Id)).DeletedCount); }